pub struct LineSegment<P> { /* private fields */ }Expand description
LineSegment defined by a start and an endpoint, evaluable anywhere inbetween using interpolation parameter t: [0, 1] in eval().
A LineSegment is equal to a linear Bezier curve, which is why there is no specialized type for that case.
Methods that need component access or norms add PointIndex/PointNorm
bounds as required.
Implementations§
Source§impl<P> LineSegment<P>where
P: Point,
impl<P> LineSegment<P>where
P: Point,
Sourcepub fn split(&self, t: P::Scalar) -> (Self, Self)
pub fn split(&self, t: P::Scalar) -> (Self, Self)
Split the segment at t into two sub-segments.
Sourcepub fn distance_to_point(&self, p: P) -> P::Scalarwhere
P: PointNorm,
pub fn distance_to_point(&self, p: P) -> P::Scalarwhere
P: PointNorm,
Return the distance from the LineSegment to Point p by calculating the projection
Sourcepub fn derivative(&self) -> P
pub fn derivative(&self) -> P
Return the derivative vector of the segment.
Sourcepub fn tangent(&self, _t: P::Scalar) -> Pwhere
P: PointNorm,
pub fn tangent(&self, _t: P::Scalar) -> Pwhere
P: PointNorm,
Return the unit tangent direction at t.
Sourcepub fn curvature(&self, _t: P::Scalar) -> P::Scalarwhere
P: PointNorm,
pub fn curvature(&self, _t: P::Scalar) -> P::Scalarwhere
P: PointNorm,
Return the curvature magnitude at t.
Lines have zero curvature, so this always returns 0.
Sourcepub fn normal(&self, _t: P::Scalar) -> Option<P>where
P: PointNorm,
pub fn normal(&self, _t: P::Scalar) -> Option<P>where
P: PointNorm,
Return the principal normal direction at t.
Lines have zero curvature, so this always returns None.
Sourcepub fn t_at_length_approx(&self, s: P::Scalar, _nsteps: usize) -> P::Scalarwhere
P: PointNorm,
pub fn t_at_length_approx(&self, s: P::Scalar, _nsteps: usize) -> P::Scalarwhere
P: PointNorm,
Approximate parameter t at arc length s.
Sourcepub fn t_at_length(&self, s: P::Scalar) -> P::Scalarwhere
P: PointNorm,
pub fn t_at_length(&self, s: P::Scalar) -> P::Scalarwhere
P: PointNorm,
Approximate parameter t at arc length s using a default resolution.
Sourcepub fn point_at_length_approx(&self, s: P::Scalar, nsteps: usize) -> Pwhere
P: PointNorm,
pub fn point_at_length_approx(&self, s: P::Scalar, nsteps: usize) -> Pwhere
P: PointNorm,
Evaluate the point at arc length s.
Sourcepub fn point_at_length(&self, s: P::Scalar) -> Pwhere
P: PointNorm,
pub fn point_at_length(&self, s: P::Scalar) -> Pwhere
P: PointNorm,
Evaluate the point at arc length s using a default resolution.
Sourcepub fn bounding_box(&self) -> [(P::Scalar, P::Scalar); P::DIM]where
P: PointIndex,
pub fn bounding_box(&self) -> [(P::Scalar, P::Scalar); P::DIM]where
P: PointIndex,
Return the bounding box of the line as an array of (min, max) tuples for each dimension (its index)
Trait Implementations§
Source§impl<P: Clone> Clone for LineSegment<P>
impl<P: Clone> Clone for LineSegment<P>
Source§fn clone(&self) -> LineSegment<P>
fn clone(&self) -> LineSegment<P>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more