Function spade::validate_coordinate

source ·
pub fn validate_coordinate<S: SpadeNum>(value: S) -> Result<(), InsertionError>
Expand description

Checks if a coordinate value is suitable for insertion into a Delaunay triangulation.

Will return an error if and only if

  • The absolute value of the coordinate is too small (See MIN_ALLOWED_VALUE)
  • The absolute value of the coordinate is too large (See MAX_ALLOWED_VALUE)
  • The coordinate is NaN (not a number)

Passing in any non-finite floating point number (e.g. f32::NEG_INFINITY) will result in Err(InsertionError::TooLarge).

Note that any non-nan, finite, normal f32 coordinate will always be valid. However, subnormal f32 numbers may still cause an underflow.

See also mitigate_underflow