pub struct LineSeg2 { /* private fields */ }Expand description
A finite line segment.
Implementations§
Source§impl LineSeg2
impl LineSeg2
Sourcepub fn intersect_line(
&self,
other: &Self,
policy: &CurvePolicy,
) -> CurveResult<LineLineIntersection>
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.
Sourcepub fn intersect_arc(
&self,
arc: &CircularArc2,
policy: &CurvePolicy,
) -> CurveResult<LineArcIntersection>
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.
Sourcepub fn supporting_line_circle_relation(
&self,
arc: &CircularArc2,
policy: &CurvePolicy,
) -> CurveResult<LineCircleRelation>
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
impl LineSeg2
Sourcepub fn offset_left(&self, distance: Real) -> CurveResult<Self>
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
impl LineSeg2
Sourcepub fn try_new(start: Point2, end: Point2) -> CurveResult<Self>
pub fn try_new(start: Point2, end: Point2) -> CurveResult<Self>
Constructs a line segment and rejects equal endpoints when provable.
Sourcepub const fn new_unchecked(start: Point2, end: Point2) -> Self
pub const fn new_unchecked(start: Point2, end: Point2) -> Self
Constructs a line segment without validating endpoint distinctness.
Sourcepub fn length_squared(&self) -> Real
pub fn length_squared(&self) -> Real
Returns squared segment length.
Sourcepub fn point_at(&self, t: Real) -> Point2
pub fn point_at(&self, t: Real) -> Point2
Returns the point at affine parameter t, where 0 is start and 1 is end.
Sourcepub fn classify_point(
&self,
point: &Point2,
policy: &CurvePolicy,
) -> Classification<LineSide>
pub fn classify_point( &self, point: &Point2, policy: &CurvePolicy, ) -> Classification<LineSide>
Classifies a point relative to this oriented line segment’s supporting line.
Sourcepub fn prepare_topology_queries(&self) -> PreparedLineSeg2<'_>
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.
Sourcepub fn contains_point(
&self,
point: &Point2,
policy: &CurvePolicy,
) -> Classification<bool>
pub fn contains_point( &self, point: &Point2, policy: &CurvePolicy, ) -> Classification<bool>
Classifies whether a point lies on this finite line segment.
Sourcepub fn structural_facts(&self) -> LineSeg2Facts
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
impl LineSeg2
Sourcepub fn transform_similarity(&self, transform: &Similarity2) -> CurveResult<Self>
pub fn transform_similarity(&self, transform: &Similarity2) -> CurveResult<Self>
Applies a certified planar similarity transform.