Skip to main content

Module robust

Module robust 

Source
Expand description

Robust geometric predicates for numerical stability.

This module provides numerically robust implementations of geometric predicates using Shewchuk’s adaptive precision floating-point arithmetic.

§Core Predicates

The core predicates (orient2d, orient2d_filtered, point_in_triangle, is_convex, is_ccw, Orientation) are provided by u-geometry and re-exported here for API compatibility.

§Nesting-Specific Utilities

§References

§Example

use u_nesting_core::robust::{orient2d, Orientation};

// Check orientation of three points
let a = (0.0, 0.0);
let b = (1.0, 0.0);
let c = (0.5, 1.0);

match orient2d(a, b, c) {
    Orientation::CounterClockwise => println!("Left turn"),
    Orientation::Clockwise => println!("Right turn"),
    Orientation::Collinear => println!("Straight"),
}

Structs§

ScalingConfig
Configuration for coordinate scaling.

Enums§

Orientation
Result of an orientation test.

Functions§

is_ccw
Checks if a polygon has counter-clockwise winding order.
is_ccw_robust
Checks if a polygon has counter-clockwise winding order.
is_convex
Checks if a polygon is convex using robust orientation tests.
is_convex_robust
Checks if a polygon is convex using robust orientation tests.
orient2d
Determines the orientation of three points using exact arithmetic.
orient2d_filtered
Fast orientation test with exact fallback.
orient2d_raw
Returns the raw orientation determinant (twice the signed area).
point_in_triangle
Checks if a point lies strictly inside a triangle.
point_in_triangle_inclusive
Checks if a point lies inside or on the boundary of a triangle.
point_in_triangle_inclusive_robust
Checks if a point lies inside or on the boundary of a triangle.
point_in_triangle_robust
Checks if a point lies strictly inside a triangle.
signed_area_robust
Computes the signed area of a polygon using Kahan summation.
snap_polygon_to_grid
Snaps an entire polygon to a grid.
snap_to_grid
Snaps coordinates to a grid of the given resolution.