pub struct Tolerance {
pub point_eps: f64,
pub distance_eps: f64,
pub area_eps: f64,
pub angle_eps: f64,
pub sample_eps: f64,
}Expand description
Named epsilons. Lengths are in model units.
Fields§
§point_eps: f64Point equality.
distance_eps: f64Geometric distance comparisons (contact heights, offsets, clipping).
area_eps: f64Zero-area loop/triangle checks.
angle_eps: f64Dot/cross comparisons (unitless).
sample_eps: f64Minimum accepted span/sample distance.
Implementations§
Source§impl Tolerance
impl Tolerance
Sourcepub const REFERENCE_DIAGONAL: f64 = 1000.0
pub const REFERENCE_DIAGONAL: f64 = 1000.0
Bounding-box diagonal the defaults are tuned for (a part about a metre across).
Sourcepub const MAX_SCALE: f64 = 1e3
pub const MAX_SCALE: f64 = 1e3
Scale factor clamp: tolerances never move more than this far from the defaults.
Sourcepub fn scaled_for_diagonal(diagonal: f64) -> Self
pub fn scaled_for_diagonal(diagonal: f64) -> Self
Defaults scaled for a model whose bounding-box diagonal is diagonal.
Length epsilons scale linearly, the area epsilon quadratically, the
angle epsilon not at all. A non-positive or non-finite diagonal yields
the defaults.
Sourcepub fn validate(&self) -> Result<(), NumericError>
pub fn validate(&self) -> Result<(), NumericError>
Every epsilon finite and positive.
pub fn points_equal(&self, a: Point3, b: Point3) -> bool
pub fn distances_equal(&self, a: f64, b: f64) -> bool
Sourcepub fn distance_less(&self, a: f64, b: f64) -> bool
pub fn distance_less(&self, a: f64, b: f64) -> bool
a is below b by more than the distance epsilon.
pub fn is_zero_area(&self, area: f64) -> bool
Sourcepub fn parallel(&self, a: Point3, b: Point3) -> bool
pub fn parallel(&self, a: Point3, b: Point3) -> bool
Two unit vectors are parallel (same or opposite sense).
Sourcepub fn perpendicular(&self, a: Point3, b: Point3) -> bool
pub fn perpendicular(&self, a: Point3, b: Point3) -> bool
Two unit vectors are perpendicular.
Sourcepub fn is_vertical(&self, dir: Point3) -> bool
pub fn is_vertical(&self, dir: Point3) -> bool
A unit direction is vertical (along ±Z) within the angle epsilon.
Sourcepub fn is_horizontal(&self, dir: Point3) -> bool
pub fn is_horizontal(&self, dir: Point3) -> bool
A unit direction is horizontal (perpendicular to Z) within the angle epsilon.
Sourcepub fn span_too_short(&self, length: f64) -> bool
pub fn span_too_short(&self, length: f64) -> bool
A span shorter than the sample epsilon is not worth a sample.