---
id: geo-pri
title: "Geometry Primitives"
author: Benjamin Qi
description: Basic setup for geometry problems and introduction to line sweep.
---

## Primitives

You should know basic operations like cross product and dot product. For platinum specifically, you should be fine as long as you know how to code **convex hull**.

### Tutorial

 - [CPC.12](https://github.com/SuprDewd/T-414-AFLV/tree/master/12_geometry)
   - basic geometry
   - convex hulls
   - polygon area
   - point in polygon
 - CPH 29 (Geometry), 30.1, 30.2 (Sweep line algorithms)
 - [TopCoder - Basic Geometry Concepts](https://www.topcoder.com/community/competitive-programming/tutorials/geometry-concepts-basic-concepts/)
 - [CF - Point Class](https://codeforces.com/blog/entry/48122)
 - [C++ - std::complex](https://codeforces.com/blog/entry/22175)
 - [cp-algo - Geometry: "Elementary Operations"](https://cp-algorithms.com/)
 - [vlecomte - Geometry Handbook](https://codeforces.com/blog/entry/59129)
 - [My Templates](https://github.com/bqi343/USACO/tree/master/Implementations/content/geometry%20(13)/Primitives)

### Problems

 - Template Testing
   - [yosupo: Sort Points by Arg](https://judge.yosupo.jp/problem/sort_points_by_argument)
   - [Kattis Segment Distance](https://open.kattis.com/problems/segmentdistance)
   - [Kattis Segment Intersection](https://open.kattis.com/problems/segmentintersection)
   - [Kattis Point in Polygon](https://open.kattis.com/problems/pointinpolygon)
   - [Kattis Polygon Area](https://open.kattis.com/problems/polygonarea)
   - [Kattis Max Collinear](https://open.kattis.com/problems/maxcolinear)
 - Misc
   - [Arpa & Geo](http://codeforces.com/problemset/problem/851/B)
   - [Tell Your World](http://codeforces.com/problemset/problem/849/B)
   - [Gleb & Pizza](http://codeforces.com/problemset/problem/842/B)
   - [Birthday Cake](https://open.kattis.com/problems/birthdaycake)
   - [Racing Off Track](https://open.kattis.com/contests/acpc17open/problems/racingofftrack)
   - [TopCoder Watchtower](https://community.topcoder.com/stat?c=problem_statement&pm=2014&rd=4685)

## Sweep Line

### Tutorial

 - CPH 30
 - [TopCoder Line Sweep](https://www.topcoder.com/community/competitive-programming/tutorials/line-sweep-algorithms/)

### Problems

 - [Cow Steepchase II (Silver)](http://www.usaco.org/index.php?page=viewproblem2&cpid=943)
   - :|
 - [Kattis Closest Pair](https://open.kattis.com/problems/closestpair2)
