⚡ Build the skills to land top-paying quant jobs. Offer ends in 17d 22h 19m 30s17 days 22 hours 19 minutes 30 seconds.
⚡ Build the skills to land top-paying quant jobs. Offer ends in 17d 22h 19m 30s17 days 22 hours 19 minutes 30 seconds.

Sign in to watch this lesson
Advanced - Geometry · 3:55
Twice the oriented area of a triangle, 2S = (p2 - p1) × (p3 - p2), is a 2×2 determinant that is exact in integers. Its sign says whether the path p1 → p2 → p3 turns left (counter-clockwise), right (clockwise) or goes straight (collinear), and half its absolute value is the area. This one turn test underlies segment intersection, convex hulls and point-in-polygon checks, provided you keep one point order, use long long and give doubles a tolerance.