Skip to main content

LineSeg2

Struct LineSeg2 

Source
pub struct LineSeg2 { /* private fields */ }
Expand description

A finite line segment.

Implementations§

Source§

impl LineSeg2

Source

pub fn intersect_line( &self, other: &Self, policy: &CurvePolicy, ) -> CurveResult<LineLineIntersection>

Intersects this line segment with another line segment.

Uses the standard parametric cross-product relation p + t r = q + u s. Parallel, collinear, point, and overlap cases stay separate because polygon clipping degeneracies need those distinctions later in the boolean pipeline.

Source

pub fn intersect_arc( &self, arc: &CircularArc2, policy: &CurvePolicy, ) -> CurveResult<LineArcIntersection>

Intersects this line segment with a circular arc.

Substitutes the segment’s affine parameter into the circle equation and classifies the resulting quadratic roots once at the supporting-line layer, then filters those roots by the finite line interval and by the arc sweep. Keeping the line-circle relation explicit gives future line/arc batches a reusable exact predicate surface without moving arc topology into the algebraic primitive.

Source

pub fn supporting_line_circle_relation( &self, arc: &CircularArc2, policy: &CurvePolicy, ) -> CurveResult<LineCircleRelation>

Classifies the relation between this segment’s supporting line and an arc’s full circle.

This method ignores the finite line interval and the finite arc sweep. It returns affine parameters on the line support so callers can perform those object-level filters without recomputing the line-circle quadratic. Structural-dispatch note: exact-rational line and circle facts carried by prepared curve objects can later select specialized discriminant reducers here while preserving this public relation shape.

Source§

impl LineSeg2

Source

pub fn offset_left(&self, distance: Real) -> CurveResult<Self>

Returns the constant-distance segment on this segment’s left side.

The offset direction is the normalized left normal (-dy, dx) / length. This is the primitive line-profile case used by profile offset algorithms; higher-level curve-string offsetting must still add joins, trim self-intersections, and rebuild topology. See Tiller and Hanson, “Offsets of Two-Dimensional Profiles” (1984), for the line/arc primitive plus trim-and-join framing used by many CAD offset pipelines.

Source§

impl LineSeg2

Source

pub fn try_new(start: Point2, end: Point2) -> CurveResult<Self>

Constructs a line segment and rejects equal endpoints when provable.

Source

pub const fn new_unchecked(start: Point2, end: Point2) -> Self

Constructs a line segment without validating endpoint distinctness.

Source

pub const fn start(&self) -> &Point2

Returns the segment start point.

Source

pub const fn end(&self) -> &Point2

Returns the segment end point.

Source

pub fn delta(&self) -> (Real, Real)

Returns (end.x - start.x, end.y - start.y).

Source

pub fn length_squared(&self) -> Real

Returns squared segment length.

Source

pub fn point_at(&self, t: Real) -> Point2

Returns the point at affine parameter t, where 0 is start and 1 is end.

Source

pub fn reversed(&self) -> Self

Returns this segment with traversal direction reversed.

Source

pub fn classify_point( &self, point: &Point2, policy: &CurvePolicy, ) -> Classification<LineSide>

Classifies a point relative to this oriented line segment’s supporting line.

Source

pub fn prepare_topology_queries(&self) -> PreparedLineSeg2<'_>

Prepares this line segment for repeated supporting-line classifications.

The prepared view caches segment facts and predicate endpoint conversion, but it delegates every sidedness branch to the same exact predicate policy as LineSeg2::classify_point.

Source

pub fn contains_point( &self, point: &Point2, policy: &CurvePolicy, ) -> Classification<bool>

Classifies whether a point lies on this finite line segment.

Source

pub fn structural_facts(&self) -> LineSeg2Facts

Returns conservative structural facts for this line segment.

Axis-aligned and shared-scale facts are scheduling hints only. They help select faster exact kernels without becoming a substitute for the orientation predicates used for topology.

Source§

impl LineSeg2

Source

pub fn transform_similarity(&self, transform: &Similarity2) -> CurveResult<Self>

Applies a certified planar similarity transform.

Trait Implementations§

Source§

impl Clone for LineSeg2

Source§

fn clone(&self) -> LineSeg2

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 LineSeg2

Source§

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

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

impl PartialEq for LineSeg2

Source§

fn eq(&self, other: &LineSeg2) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for LineSeg2

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.