---
id: hull
title: "Convex Hull"
author: Benjamin Qi
description: Smallest convex polygon containing a set of points on a grid.
prerequisites:
- Platinum - Geometry Primitives
frequency: 2
---
import { Problem } from "../models";
export const metadata = {
problems: {
sample: [
new Problem("Kattis", "Convex Hull", "convexhull", "Easy", false, ["convex"], ""),
],
sample2: [
new Problem("Kattis","Robert Hood", "roberthood", "Easy", false, ["convex"], "doesn't require convex hull since coordinates are small"),
],
general: [
new Problem("Plat", "Balance Beam", "864", "Hard", false, ["convex"], ""),
new Problem("CF", "Water Balance", "problemset/problem/1299/C", "Easy", false, ["convex"], ""),
new Problem("CF", "Geometers Anonymous", "problemset/problem/1195/F", "Normal", false, ["convex", "PURS"], ""),
new Problem("Old Gold", "Cow Curling", "382", "Normal", false, ["convex"], "testing whether points are inside hull"),
new Problem("AC", "AGC E - Random Pawn", "https://atcoder.jp/contests/agc044/tasks/agc044_e", "Insane", false, ["convex"], ""),
],
rotating: [
new Problem("Kattis", "Fence Orthogonality", "fenceortho", "Hard", false, ["convex"], "enclosing rectangle"),
],
cht: [
new Problem("Plat", "Circular Barn", "626", "Hard", false, ["DP", "convex"], ""),
new Problem("Plat", "Falling Portals", "998", "Very Hard", false, ["convex"], ""),
],
}
};
## [Convex Hull](https://en.wikipedia.org/wiki/Convex_hull_algorithms)
### Tutorial
- Graham Scan
- [cp-algo](https://cp-algorithms.com/geometry/grahams-scan-convex-hull.html)
- [My Implementation](https://github.com/bqi343/USACO/blob/master/Implementations/content/geometry%20(13)/Polygons/ConvexHull2.h)
- Monotone Chain
- CPH 30.3 (brief)
- [Wikipedia](https://en.wikibooks.org/wiki/Algorithm_Implementation/Geometry/Convex_hull/Monotone_chain)
- [My Implementation](https://github.com/bqi343/USACO/blob/master/Implementations/content/geometry%20(13)/Polygons/ConvexHull%20(13.2).h)
## Rotating Caliphers
## Convex Hull Trick
https://codeforces.com/contest/1083/problem/E