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.

§Background

Standard floating-point arithmetic can produce incorrect results for geometric predicates when points are nearly collinear or cocircular. This module provides robust alternatives that guarantee correct results.

§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_robust
Checks if a polygon has counter-clockwise winding order.
is_convex_robust
Checks if a polygon is convex using robust orientation tests.
orient2d
Determines the orientation of three 2D points.
orient2d_filtered
Fast orientation test with exact fallback.
orient2d_raw
Returns the raw orientation determinant value.
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 robust arithmetic.
snap_polygon_to_grid
Snaps an entire polygon to a grid.
snap_to_grid
Snaps coordinates to a grid of the given resolution.