Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 1d 16h 01m 43s1 days 16 hours 1 minutes 43 seconds.
Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 1d 16h 01m 43s1 days 16 hours 1 minutes 43 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.