Expand description
This is a direct transcript of the sourcecode and algorithms provided by Jonathan Richard Shewchuk (https://www.cs.cmu.edu/~quake/robust.html) See the paper and the source code for more information.
The module offers adaptive and precise calculations for orientation queries (on which side of a line does a point lie?) and in-circle queries (is a given point contained in the circumference of a triangle?) The “adaptive” nature will increase performance only if a simpler calculation cannot be guaranteed to be accurate enough, yielding higher performance on average.
The public API will accept both f32
and f64
input points for predicate checking, with input being converted to
f64
values for internal use.
This has no effect on precision, as the IEEE-754 standard (section 5.3)
guarantees that conversion from f32
to f64
must be exact.
§Features
no_std
: Build without the Rust standard library
Structs§
- Coord
- A two dimensional coordinate.
Functions§
- incircle
- Returns a positive value if the coordinate
pd
lies outside the circle passing throughpa
,pb
, andpc
.
Returns a negative value if it lies inside the circle.
Returns0
if the four points are cocircular. - orient2d
- Returns a positive value if the coordinates
pa
,pb
, andpc
occur in counterclockwise order (pc lies to the left of the directed line defined by coordinates pa and pb).
Returns a negative value if they occur in clockwise order (pc
lies to the right of the directed linepa, pb
).
Returns0
if they are collinear.