pub struct LineSegment<T, D>where
    T: Scalar,
    D: DimName,
    DefaultAllocator: Allocator<T, D>,
{ /* private fields */ }

Implementations§

source§

impl<T: Real> LineSegment<T, Const<3>>

source

pub fn closest_point_to_plane_parametric(&self, plane: &Plane<T>) -> T

source

pub fn closest_point_to_plane(&self, plane: &Plane<T>) -> Point3<T>

source§

impl<T, D> LineSegment<T, D>where
    T: Scalar,
    D: DimName,
    DefaultAllocator: Allocator<T, D>,

source

pub fn from_end_points(start: OPoint<T, D>, end: OPoint<T, D>) -> Self

source

pub fn start(&self) -> &OPoint<T, D>

source

pub fn end(&self) -> &OPoint<T, D>

source

pub fn reverse(&self) -> Self

source§

impl<T, D> LineSegment<T, D>where
    T: Real,
    D: DimName,
    DefaultAllocator: Allocator<T, D>,

source

pub fn to_line(&self) -> Line<T, D>

source

pub fn tangent_dir(&self) -> OVector<T, D>

Returns the vector tangent to the line, pointing from start to end.

Note that the vector is not normalized.

source

pub fn length(&self) -> T

source

pub fn midpoint(&self) -> OPoint<T, D>

source

pub fn closest_point_parametric(&self, point: &OPoint<T, D>) -> T

Compute the closest point on the segment to the given point, represented in the parametric form x = a + t * (b - a).

source

pub fn closest_point(&self, point: &OPoint<T, D>) -> OPoint<T, D>

Computes the closest point on the line to the given point.

source

pub fn point_from_parameter(&self, t: T) -> OPoint<T, D>

source§

impl<T> LineSegment<T, Const<2>>where
    T: Real,

source

pub fn normal_dir(&self) -> Vector2<T>

Returns a vector normal to the line segment, in the direction consistent with a counter-clockwise winding order when the edge is part of a polygon.

In other words, the normal direction points “to the right” when following the segment from its first endpoint to its second.

Note that the vector is not normalized.

source

pub fn intersect_line_parametric(&self, line: &Line2d<T>) -> Option<T>

source

pub fn intersect_disk_parametric(&self, disk: &Disk<T>) -> Option<[T; 2]>

source

pub fn intersect_disk(&self, disk: &Disk<T>) -> Option<Self>

source

pub fn segment_from_parameters(&self, t_begin: &T, t_end: &T) -> Self

source

pub fn intersect_segment_parametric(&self, other: &LineSegment2d<T>) -> Option<T>

Computes the intersection of two line segments (if any), but returns the result as a parameter.

Let all points on this line segment be defined by the relation x = a + t * (b - a) for 0 <= t <= 1. Then, if the two line segments intersect, t is returned. Otherwise, None is returned.

source

pub fn intersect_half_plane_parametric(
    &self,
    half_plane: &HalfPlane<T>
) -> Option<[T; 2]>

Compute the intersection between the line segment and a half-plane.

Returns None if the segment and the half-plane do not intersect, otherwise returns Some([t1, t2]) with t1 <= t2, and t1 and t2 correspond to the start and end parameters relative to the current line segment.

source

pub fn intersect_half_plane(&self, half_plane: &HalfPlane<T>) -> Option<Self>

source

pub fn intersect_polygon(
    &self,
    other: &ConvexPolygon<T>
) -> Option<LineSegment2d<T>>

source§

impl<T: Real> LineSegment<T, Const<3>>

source

pub fn intersect_plane_parametric(&self, plane: &Plane<T>) -> Option<T>

Trait Implementations§

source§

impl<T, D> Clone for LineSegment<T, D>where
    T: Scalar + Clone,
    D: DimName + Clone,
    DefaultAllocator: Allocator<T, D>,

source§

fn clone(&self) -> LineSegment<T, D>

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<T, D> Debug for LineSegment<T, D>where
    T: Scalar + Debug,
    D: DimName + Debug,
    DefaultAllocator: Allocator<T, D>,

source§

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

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

impl<T> From<LineSegment<T, Const<2>>> for ConvexPolygon<T>where
    T: Scalar,

source§

fn from(segment: LineSegment2d<T>) -> Self

Converts to this type from the input type.
source§

impl<T, D> PartialEq<LineSegment<T, D>> for LineSegment<T, D>where
    T: Scalar + PartialEq,
    D: DimName + PartialEq,
    DefaultAllocator: Allocator<T, D>,

source§

fn eq(&self, other: &LineSegment<T, D>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T, D> Eq for LineSegment<T, D>where
    T: Scalar + Eq,
    D: DimName + Eq,
    DefaultAllocator: Allocator<T, D>,

source§

impl<T, D> StructuralEq for LineSegment<T, D>where
    T: Scalar,
    D: DimName,
    DefaultAllocator: Allocator<T, D>,

source§

impl<T, D> StructuralPartialEq for LineSegment<T, D>where
    T: Scalar,
    D: DimName,
    DefaultAllocator: Allocator<T, D>,

Auto Trait Implementations§

§

impl<T, D> !RefUnwindSafe for LineSegment<T, D>

§

impl<T, D> !Send for LineSegment<T, D>

§

impl<T, D> !Sync for LineSegment<T, D>

§

impl<T, D> !Unpin for LineSegment<T, D>

§

impl<T, D> !UnwindSafe for LineSegment<T, D>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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> Same<T> for T

§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SPwhere
    SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

impl<T> ToOwned for Twhere
    T: Clone,

§

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 Twhere
    U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

impl<T> Scalar for Twhere
    T: 'static + Clone + PartialEq<T> + Debug,