Skip to main content

ExactPoints

Struct ExactPoints 

Source
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

Source

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.

Source

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.

Source

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.

Source

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

Source

pub fn new() -> Self

An empty store whose orientation is counter-clockwise in (x, y).

Source

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.

Source

pub fn frame_sign(&self) -> Sign

The frame sign the store was made with.

Source

pub fn len(&self) -> usize

The number of points.

Source

pub fn is_empty(&self) -> bool

Whether the store has no point.

Source

pub fn push_flat(&mut self, flat: Point2) -> GeomResult<PointId>

A binary64 position.

Source

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.

Source

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.

Source

pub fn flat(&self, point: PointId) -> Option<Point2>

The coordinates of a point that is a binary64 position (w = 1).

Source

pub fn exact(&self, point: PointId) -> &[Dyadic; 3]

The exact homogeneous coordinates of a point, w > 0.

Source

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.

Source

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.

Source

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).

Source

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.

Source

pub fn same(&self, a: PointId, b: PointId) -> GeomResult<bool>

Whether a and b are the same point.

Source

pub fn lexicographic(&self, a: PointId, b: PointId) -> GeomResult<Ordering>

Order by x, then y.

Source

pub fn bounds(&self, point: PointId) -> [f64; 4]

[x_lo, y_lo, x_hi, y_hi], a sound box of the point.

Source

pub fn dominant(&self, a: PointId, b: PointId) -> GeomResult<usize>

The axis along which two distinct points of a line differ.

Source

pub fn ordered( &self, a: PointId, b: PointId, axis: usize, ) -> GeomResult<(PointId, PointId)>

(low, high) of two points along axis.

Source

pub fn strictly_between( &self, before: PointId, at: PointId, after: PointId, ) -> GeomResult<bool>

Whether collinear at lies strictly between before and after.

Source

pub fn within_segment( &self, point: PointId, start: PointId, end: PointId, ) -> GeomResult<bool>

Whether collinear point lies on the closed segment start-end.

Source

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.

Source

pub fn ring_box(&self, ring: &[PointId]) -> RingBox

The boxes of a ring of exact points.

Source

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.

Source

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

Source§

fn clone(&self) -> ExactPoints

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ExactPoints

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ExactPoints

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.