pub struct Line<S> where
S: EuclideanSpace, {
pub origin: S,
pub direction: Unit<<S as EuclideanSpace>::CoordinateSpace>,
}
Expand description
Line.
Describes a line containing an origin point and a direction. Lines
extend infinitely from their origin along their direction $\hat{u}$. Unlike
Ray
, the direction component of Line
extends in both the positive and
negative.
This representation is typically known as the vector form $P_0 + t\hat{u}$ where $t$ is some non-zero time of impact.
Fields
origin: S
The origin or contained point of the line.
direction: Unit<<S as EuclideanSpace>::CoordinateSpace>
The unit direction(s) in which the line extends from its origin.
Implementations
sourceimpl<S> Line<S> where
S: EuclideanSpace,
impl<S> Line<S> where
S: EuclideanSpace,
pub fn x() -> Line<S> where
S: FiniteDimensional,
<S as FiniteDimensional>::N: Cmp<UTerm>,
<<S as FiniteDimensional>::N as Cmp<UTerm>>::Output == Greater,
pub fn y() -> Line<S> where
S: FiniteDimensional,
<S as FiniteDimensional>::N: Cmp<UInt<UTerm, B1>>,
<<S as FiniteDimensional>::N as Cmp<UInt<UTerm, B1>>>::Output == Greater,
pub fn z() -> Line<S> where
S: FiniteDimensional,
<S as FiniteDimensional>::N: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<S as FiniteDimensional>::N as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
pub fn into_ray(self) -> Ray<S>
sourceimpl<S> Line<S> where
S: EuclideanSpace<N = UInt<UInt<UTerm, B1>, B0>> + FiniteDimensional,
impl<S> Line<S> where
S: EuclideanSpace<N = UInt<UInt<UTerm, B1>, B0>> + FiniteDimensional,
pub fn slope(
&self
) -> Option<<<S as EuclideanSpace>::CoordinateSpace as VectorSpace>::Scalar>
pub fn x_intercept(
&self
) -> Option<<<S as EuclideanSpace>::CoordinateSpace as VectorSpace>::Scalar>
pub fn y_intercept(
&self
) -> Option<<<S as EuclideanSpace>::CoordinateSpace as VectorSpace>::Scalar>
Trait Implementations
sourceimpl<S> Clone for Line<S> where
S: Clone + EuclideanSpace,
impl<S> Clone for Line<S> where
S: Clone + EuclideanSpace,
sourceimpl<S> Debug for Line<S> where
S: Debug + EuclideanSpace,
<S as EuclideanSpace>::CoordinateSpace: Debug,
impl<S> Debug for Line<S> where
S: Debug + EuclideanSpace,
<S as EuclideanSpace>::CoordinateSpace: Debug,
sourceimpl<S> Default for Line<S> where
S: EuclideanSpace,
impl<S> Default for Line<S> where
S: EuclideanSpace,
sourceimpl<S> Intersection<Line<S>> for Line<S> where
S: EuclideanSpace<N = UInt<UInt<UTerm, B1>, B0>> + FiniteDimensional,
impl<S> Intersection<Line<S>> for Line<S> where
S: EuclideanSpace<N = UInt<UInt<UTerm, B1>, B0>> + FiniteDimensional,
Intersection of lines in two dimensions.
type Output = LineLine<S>
fn intersection(
&self,
other: &Line<S>
) -> Option<<Line<S> as Intersection<Line<S>>>::Output>
sourceimpl<S> Intersection<Line<S>> for Plane<S> where
S: EuclideanSpace,
Line<S>: Intersection<Plane<S>>,
impl<S> Intersection<Line<S>> for Plane<S> where
S: EuclideanSpace,
Line<S>: Intersection<Plane<S>>,
Symmetrical intersection.
type Output = <Line<S> as Intersection<Plane<S>>>::Output
fn intersection(
&self,
other: &Line<S>
) -> Option<<Plane<S> as Intersection<Line<S>>>::Output>
sourceimpl<S> Intersection<Plane<S>> for Line<S> where
S: EuclideanSpace + FiniteDimensional,
<S as FiniteDimensional>::N: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<S as FiniteDimensional>::N as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
impl<S> Intersection<Plane<S>> for Line<S> where
S: EuclideanSpace + FiniteDimensional,
<S as FiniteDimensional>::N: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<S as FiniteDimensional>::N as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
Intersection of a line and a plane.
type Output = LinePlane<S>
type Output = LinePlane<S>
The time of impact of a point intersection or the line if it lies within the plane.
The time of impact $t$ describes the distance from the line’s origin point at which the intersection occurs.
sourcefn intersection(
&self,
plane: &Plane<S>
) -> Option<<Line<S> as Intersection<Plane<S>>>::Output>
fn intersection(
&self,
plane: &Plane<S>
) -> Option<<Line<S> as Intersection<Plane<S>>>::Output>
Determines if a line intersects a plane at a point or lies within the
plane. Computes the time of impact of a Line
for a point
intersection.
Given a line formed from an origin $P_0$ and a unit direction $\hat{u}$, the point of intersection with the plane is $P_0 + t\hat{u}$.
sourceimpl<S> PointPartition<S> for Line<S> where
S: EuclideanSpace + FiniteDimensional<N = U2>,
impl<S> PointPartition<S> for Line<S> where
S: EuclideanSpace + FiniteDimensional<N = U2>,
fn partition(&self, point: S) -> Option<BinaryPartition>
impl<S> Copy for Line<S> where
S: Copy + EuclideanSpace,
impl<S> StructuralPartialEq for Line<S> where
S: EuclideanSpace,
Auto Trait Implementations
impl<S> RefUnwindSafe for Line<S> where
S: RefUnwindSafe,
<S as EuclideanSpace>::CoordinateSpace: RefUnwindSafe,
impl<S> Send for Line<S> where
S: Send,
<S as EuclideanSpace>::CoordinateSpace: Send,
impl<S> Sync for Line<S> where
S: Sync,
<S as EuclideanSpace>::CoordinateSpace: Sync,
impl<S> Unpin for Line<S> where
S: Unpin,
<S as EuclideanSpace>::CoordinateSpace: Unpin,
impl<S> UnwindSafe for Line<S> where
S: UnwindSafe,
<S as EuclideanSpace>::CoordinateSpace: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> FromGeometry<T> for T
impl<T> FromGeometry<T> for T
fn from_geometry(other: T) -> T
sourceimpl<T, U> IntoGeometry<U> for T where
U: FromGeometry<T>,
impl<T, U> IntoGeometry<U> for T where
U: FromGeometry<T>,
fn into_geometry(self) -> U
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
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
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
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
fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.