Struct LineSegment

Source
pub struct LineSegment<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>

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>

Source§

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

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<T, D> Debug for LineSegment<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 for LineSegment<T, D>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

const 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<T, D> Eq for LineSegment<T, D>
where T: Scalar + Eq, D: DimName + Eq, DefaultAllocator: Allocator<T, D>,

Source§

impl<T, D> StructuralPartialEq for LineSegment<T, D>

Auto Trait Implementations§

§

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

§

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 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

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

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

fn is_in_subset(&self) -> bool

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

fn to_subset_unchecked(&self) -> SS

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

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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.
Source§

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