Skip to main content

orient_3d

Function orient_3d 

Source
pub fn orient_3d(a: &[f64; 3], b: &[f64; 3], c: &[f64; 3], d: &[f64; 3]) -> i16
Expand description

Computes the orientation predicate in 3d.

Computes the sign of the signed volume of the tetrahedron a, b, c, d.

§Parameters

  • a, b, c, d vertices of the tetrahedron

§Return values

  • +1 - if the tetrahedron is oriented positively
  • 0 - if the tetrahedron is flat
  • -1 - if the tetrahedron is oriented negatively

§Example

use geogram_predicates as gp;

// Define four points that form a tetrahedron
let a = [0.0, 0.0, 0.0];
let b = [2.0, 0.0, 0.0];
let c = [0.0, 2.0, 0.0];
let d = [0.75, 0.75, 1.0];

assert_eq!(1, gp::orient_3d(&a, &b, &c, &d));