Skip to main content

Predicates

Trait Predicates 

Source
pub trait Predicates {
    // Required methods
    fn orient2d(a: P2, b: P2, c: P2) -> Sign;
    fn orient3d(a: P3, b: P3, c: P3, d: P3) -> Sign;
    fn incircle(a: P2, b: P2, c: P2, d: P2) -> Sign;
    fn insphere(a: P3, b: P3, c: P3, d: P3, e: P3) -> Sign;

    // Provided methods
    fn is_left_of(a: P2, b: P2, c: P2) -> bool { ... }
    fn are_collinear(a: P2, b: P2, c: P2) -> bool { ... }
    fn are_coplanar(a: P3, b: P3, c: P3, d: P3) -> bool { ... }
}
Expand description

Orientation and incircle/insphere tests.

Implementations must agree on sign conventions; only their accuracy and cost may differ.

Required Methods§

Source

fn orient2d(a: P2, b: P2, c: P2) -> Sign

Sign of the area of triangle (a, b, c).

Sign::Positive when the three points are counter-clockwise, Sign::Zero when collinear.

Source

fn orient3d(a: P3, b: P3, c: P3, d: P3) -> Sign

Sign of the volume of tetrahedron (a, b, c, d).

Sign::Positive when d lies below the plane through a, b, c, where “below” is the side from which a, b, c appear clockwise. Sign::Zero when the four points are coplanar.

Source

fn incircle(a: P2, b: P2, c: P2, d: P2) -> Sign

Whether d lies inside the circle through a, b, c.

Sign::Positive for inside. a, b, c must be counter-clockwise; otherwise the sign is inverted.

Source

fn insphere(a: P3, b: P3, c: P3, d: P3, e: P3) -> Sign

Whether e lies inside the sphere through a, b, c, d.

Sign::Positive for inside. a, b, c, d must be positively oriented; otherwise the sign is inverted.

Provided Methods§

Source

fn is_left_of(a: P2, b: P2, c: P2) -> bool

Whether c lies to the left of the directed line a -> b.

Source

fn are_collinear(a: P2, b: P2, c: P2) -> bool

Whether three points are collinear, exactly.

Source

fn are_coplanar(a: P3, b: P3, c: P3, d: P3) -> bool

Whether four points are coplanar, exactly.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§