pub struct ExactPoints { /* private fields */ }Expand description
A store of exact points and the exact predicates on them.
Orientation is counter-clockwise in (x, y) times the frame sign given to
ExactPoints::with_frame_sign; a caller whose (x, y) are the
coordinates of a mirrored frame passes Sign::Negative and reads
“counter-clockwise” in its own frame.
Implementations§
Source§impl ExactPoints
impl ExactPoints
Sourcepub fn nearest_on_segment(
&self,
point: PointId,
start: PointId,
end: PointId,
) -> GeomResult<Nearest>
pub fn nearest_on_segment( &self, point: PointId, start: PointId, end: PointId, ) -> GeomResult<Nearest>
Where the point of the segment start-end nearest to point lies:
an end when the projection of point falls on or beyond it, else the
foot of the perpendicular. InvalidInput when the ends are equal.
Sourcepub fn foot(
&mut self,
point: PointId,
start: PointId,
end: PointId,
) -> GeomResult<PointId>
pub fn foot( &mut self, point: PointId, start: PointId, end: PointId, ) -> GeomResult<PointId>
The foot of the perpendicular from point to the line through start
and end, an exact rational point. It lies on the segment exactly
when ExactPoints::nearest_on_segment says Interior.
InvalidInput when the ends are equal.
Sourcepub fn compare_distance(
&self,
a: PointId,
b: PointId,
length: f64,
) -> GeomResult<Ordering>
pub fn compare_distance( &self, a: PointId, b: PointId, length: f64, ) -> GeomResult<Ordering>
The order of the distance between a and b against length:
Less when they are closer, Equal at exactly length.
InvalidInput unless length is finite and not negative.
Sourcepub fn compare_line_distance(
&self,
point: PointId,
start: PointId,
end: PointId,
length: f64,
) -> GeomResult<Ordering>
pub fn compare_line_distance( &self, point: PointId, start: PointId, end: PointId, length: f64, ) -> GeomResult<Ordering>
The order of the distance from point to the line through start and
end against length: Less when it is closer, Equal at exactly
length. InvalidInput unless length is finite and not negative,
or when the ends are equal.
Source§impl ExactPoints
impl ExactPoints
Sourcepub fn with_frame_sign(frame_sign: Sign) -> Self
pub fn with_frame_sign(frame_sign: Sign) -> Self
An empty store whose orientation is frame_sign times the sense of
(x, y). frame_sign must not be Sign::Zero.
Sourcepub fn frame_sign(&self) -> Sign
pub fn frame_sign(&self) -> Sign
The frame sign the store was made with.
Sourcepub fn push_flat(&mut self, flat: Point2) -> GeomResult<PointId>
pub fn push_flat(&mut self, flat: Point2) -> GeomResult<PointId>
A binary64 position.
Sourcepub fn push(&mut self, homogeneous: [Dyadic; 3]) -> GeomResult<PointId>
pub fn push(&mut self, homogeneous: [Dyadic; 3]) -> GeomResult<PointId>
The point (x / w, y / w) of homogeneous coordinates with w != 0.
A negative w is normalised. A point that is a binary64 position is
stored as one, so it takes the fast path of the predicates.
Sourcepub fn push_hinted(
&mut self,
homogeneous: [Dyadic; 3],
hints: [Option<f64>; 2],
) -> GeomResult<PointId>
pub fn push_hinted( &mut self, homogeneous: [Dyadic; 3], hints: [Option<f64>; 2], ) -> GeomResult<PointId>
Like ExactPoints::push, with a candidate value for each
coordinate to try first, such as the coordinate of an edge that does
not move in it.
Sourcepub fn flat(&self, point: PointId) -> Option<Point2>
pub fn flat(&self, point: PointId) -> Option<Point2>
The coordinates of a point that is a binary64 position (w = 1).
Sourcepub fn exact(&self, point: PointId) -> &[Dyadic; 3]
pub fn exact(&self, point: PointId) -> &[Dyadic; 3]
The exact homogeneous coordinates of a point, w > 0.
Sourcepub fn segment_crossing(&mut self, ends: [PointId; 4]) -> GeomResult<PointId>
pub fn segment_crossing(&mut self, ends: [PointId; 4]) -> GeomResult<PointId>
The point where the segments ends[0]-ends[1] and
ends[2]-ends[3] cross properly.
The lines L = a x b and the meeting point X = L1 x L2 have degrees
2 and (3, 3, 2) in the coordinates; w is made positive. When the
point is a binary64 position it takes the fast path. Parallel segments
have no crossing.
Sourcepub fn segment_parameter(&self, ends: [PointId; 4]) -> GeomResult<f64>
pub fn segment_parameter(&self, ends: [PointId; 4]) -> GeomResult<f64>
The parameter t along the first of two crossing segments (a to b
and c to d, as in ExactPoints::segment_crossing) at which they
cross: a + t (b - a). For output only.
Sourcepub fn orient(&self, a: PointId, b: PointId, c: PointId) -> GeomResult<Sign>
pub fn orient(&self, a: PointId, b: PointId, c: PointId) -> GeomResult<Sign>
Exact orientation of a, b, c: positive when they turn
counter-clockwise in the store’s sense (see ExactPoints).
Sourcepub fn compare(
&self,
a: PointId,
b: PointId,
axis: usize,
) -> GeomResult<Ordering>
pub fn compare( &self, a: PointId, b: PointId, axis: usize, ) -> GeomResult<Ordering>
Order of the coordinates of a and b along axis (0 = x, 1 = y).
The stored axes, not the frame’s.
Sourcepub fn same(&self, a: PointId, b: PointId) -> GeomResult<bool>
pub fn same(&self, a: PointId, b: PointId) -> GeomResult<bool>
Whether a and b are the same point.
Sourcepub fn lexicographic(&self, a: PointId, b: PointId) -> GeomResult<Ordering>
pub fn lexicographic(&self, a: PointId, b: PointId) -> GeomResult<Ordering>
Order by x, then y.
Sourcepub fn bounds(&self, point: PointId) -> [f64; 4]
pub fn bounds(&self, point: PointId) -> [f64; 4]
[x_lo, y_lo, x_hi, y_hi], a sound box of the point.
Sourcepub fn dominant(&self, a: PointId, b: PointId) -> GeomResult<usize>
pub fn dominant(&self, a: PointId, b: PointId) -> GeomResult<usize>
The axis along which two distinct points of a line differ.
Sourcepub fn ordered(
&self,
a: PointId,
b: PointId,
axis: usize,
) -> GeomResult<(PointId, PointId)>
pub fn ordered( &self, a: PointId, b: PointId, axis: usize, ) -> GeomResult<(PointId, PointId)>
(low, high) of two points along axis.
Sourcepub fn strictly_between(
&self,
before: PointId,
at: PointId,
after: PointId,
) -> GeomResult<bool>
pub fn strictly_between( &self, before: PointId, at: PointId, after: PointId, ) -> GeomResult<bool>
Whether collinear at lies strictly between before and after.
Sourcepub fn within_segment(
&self,
point: PointId,
start: PointId,
end: PointId,
) -> GeomResult<bool>
pub fn within_segment( &self, point: PointId, start: PointId, end: PointId, ) -> GeomResult<bool>
Whether collinear point lies on the closed segment start-end.
Sourcepub fn locate(&self, point: PointId, ring: &[PointId]) -> GeomResult<Location>
pub fn locate(&self, point: PointId, ring: &[PointId]) -> GeomResult<Location>
Where point lies relative to the closed ring: a crossing-number
walk with exact orientation tests.
orient is in the frame’s sense and the y comparisons are in the
stored axes. When the frame mirrors them the walk counts the crossings
of the opposite ray, which is the winding number negated; only zero or
nonzero is used.
Sourcepub fn round(&self, point: PointId) -> GeomResult<Point2>
pub fn round(&self, point: PointId) -> GeomResult<Point2>
Each coordinate x / w and y / w rounded once to the nearest
binary64 number, ties to even. Degenerate when one is beyond the
binary64 range.
Sourcepub fn escalations(&self) -> usize
pub fn escalations(&self) -> usize
The number of predicate calls that left the interval filter for exact arithmetic. Not counted by the flat fast path.
Trait Implementations§
Source§impl Clone for ExactPoints
impl Clone for ExactPoints
Source§fn clone(&self) -> ExactPoints
fn clone(&self) -> ExactPoints
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more