Skip to main content

Crate implicit_predicates

Crate implicit_predicates 

Source
Expand description

Exact geometric predicates over explicit and implicit points.

An implicit point is defined by an unevaluated construction, such as a point on an edge or inside a triangle. Predicates receive the construction itself and return the exact sign, without rounding the point’s coordinates.

Status: early development. Today the crate provides orient3d for explicit points, given as [f64; 3]; implicit points do not exist yet. Like every predicate of the crate, it is generated by implicit-predicates-gen from a short definition: a floating-point filter decides the common cases, and exact stages built on the expansions of implicit-predicates-core decide the rest.

use implicit_predicates::{Sign, orient3d};

let (a, b, c) = ([1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]);
// a, b and c appear counter-clockwise from (1, 1, 1), above the plane.
assert_eq!(orient3d(&a, &b, &c, &[1.0, 1.0, 1.0]), Some(Sign::Negative));
assert_eq!(orient3d(&a, &b, &c, &[0.0, 0.0, 0.0]), Some(Sign::Positive));
// A point on the plane.
assert_eq!(orient3d(&a, &b, &c, &[0.5, 0.25, 0.25]), Some(Sign::Zero));

Enums§

Sign
The sign of a real quantity.

Functions§

orient3d
The orientation of d with respect to the plane through a, b and c: the exact sign of the determinant