Skip to main content

orient2d

Function orient2d 

Source
pub fn orient2d(a: [f64; 2], b: [f64; 2], c: [f64; 2]) -> f64
Expand description

2D 方向谓词:返回点 c 相对于有向直线 a → b 的方向。

  • 正值:ca → b左侧(三点呈 CCW 顺序)
  • 负值:ca → b右侧(三点呈 CW 顺序)
  • 零:三点共线

返回值的绝对值等于三角形 abc 有向面积的两倍。