#[repr(C)]pub struct SvgLine {
pub start: SvgPoint,
pub end: SvgPoint,
}Expand description
A line segment in 2D space.
Fields§
§start: SvgPointStart point of the line
end: SvgPointEnd point of the line
Implementations§
Source§impl SvgLine
impl SvgLine
Sourcepub const fn new(start: SvgPoint, end: SvgPoint) -> SvgLine
pub const fn new(start: SvgPoint, end: SvgPoint) -> SvgLine
Creates a new line segment from start to end point
Sourcepub fn inwards_normal(&self) -> Option<SvgPoint>
pub fn inwards_normal(&self) -> Option<SvgPoint>
Computes the inward-facing normal vector for this line.
The normal points 90 degrees to the right of the line direction.
Returns None if the line has zero length.
Sourcepub fn outwards_normal(&self) -> Option<SvgPoint>
pub fn outwards_normal(&self) -> Option<SvgPoint>
Computes the outward-facing normal vector for this line (opposite of inwards_normal).
Sourcepub fn get_t_at_offset(&self, offset: f64) -> f64
pub fn get_t_at_offset(&self, offset: f64) -> f64
Returns the parametric t value (0.0–1.0) at the given arc-length offset.
Sourcepub fn get_tangent_vector_at_t(&self) -> SvgVector
pub fn get_tangent_vector_at_t(&self) -> SvgVector
Returns the tangent vector of the line.
For a line, the tangent is constant (same direction everywhere),
so no t parameter is needed.
Sourcepub fn get_x_at_t(&self, t: f64) -> f64
pub fn get_x_at_t(&self, t: f64) -> f64
Returns the X coordinate at parametric position t (0.0 = start, 1.0 = end).
Sourcepub fn get_y_at_t(&self, t: f64) -> f64
pub fn get_y_at_t(&self, t: f64) -> f64
Returns the Y coordinate at parametric position t (0.0 = start, 1.0 = end).
Sourcepub fn get_length(&self) -> f64
pub fn get_length(&self) -> f64
Returns the Euclidean length of the line segment.
Sourcepub fn get_bounds(&self) -> SvgRect
pub fn get_bounds(&self) -> SvgRect
Returns the axis-aligned bounding rectangle of this line segment.
Trait Implementations§
Source§impl PartialOrd for SvgLine
impl PartialOrd for SvgLine
impl Copy for SvgLine
impl StructuralPartialEq for SvgLine
Auto Trait Implementations§
impl Freeze for SvgLine
impl RefUnwindSafe for SvgLine
impl Send for SvgLine
impl Sync for SvgLine
impl Unpin for SvgLine
impl UnsafeUnpin for SvgLine
impl UnwindSafe for SvgLine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more