Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 1d 16h 01m 49s1 days 16 hours 1 minutes 49 seconds.
Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 1d 16h 01m 49s1 days 16 hours 1 minutes 49 seconds.

Sign in to watch this lesson
Advanced - Geometry · 4:04
A segment PQ spans the line Ax + By + C = 0 with A = Py - Qy, B = Qx - Px and C = -A·Px - B·Py; dividing by the gcd and fixing the sign makes equal lines give equal triples. Two lines meet by Cramer's rule, whose denominator is zero exactly for parallel lines. Two segments intersect when both pairs of orientation signs disagree (a zero counts as touching), and when all four signs are zero the segments are collinear and the overlap of their projections decides; finding the intersection then yields empty, a point or a segment, with __int128 for the large intermediate values.