Skip to main content

cross2d

Function cross2d 

Source
pub fn cross2d(ax: i64, ay: i64, bx: i64, by: i64, cx: i64, cy: i64) -> i128
Expand description

2D cross product of vectors (A→B) × (A→C). Equivalent to: (bx-ax)(cy-ay) - (by-ay)(cx-ax) Positive = CCW (left turn), Negative = CW (right turn), Zero = collinear. Casts to i128 before multiply — no overflow for coords up to MAX_WORLD=40_075_017_000_000.