#[repr(C)]pub struct Line<T> {
pub start: Vec2<T>,
pub end: Vec2<T>,
}Expand description
A line segment connecting two points.
Fields§
§start: Vec2<T>The start point.
end: Vec2<T>The end point.
Implementations§
Source§impl<T: Copy + AbsDiffEq<Epsilon = T>> Line<T>
impl<T: Copy + AbsDiffEq<Epsilon = T>> Line<T>
Sourcepub fn abs_diff_eq(&self, other: &Self) -> bool
pub fn abs_diff_eq(&self, other: &Self) -> bool
Returns true if the two values are approximately equal according to the absolute difference between their components.
Source§impl<T: Copy + RelativeEq<Epsilon = T>> Line<T>
impl<T: Copy + RelativeEq<Epsilon = T>> Line<T>
Sourcepub fn relative_eq(&self, other: &Self) -> bool
pub fn relative_eq(&self, other: &Self) -> bool
Returns true if the two values are approximately equal according to the absolute difference between their components, as well as relative-based comparisons.
Source§impl<T: Float> Line<T>
impl<T: Float> Line<T>
Sourcepub fn right_norm(&self) -> Vec2<T>
pub fn right_norm(&self) -> Vec2<T>
Right-perpendicular axis of the line.
Sourcepub fn project_onto_axis(&self, axis: Vec2<T>) -> Projection<T>
pub fn project_onto_axis(&self, axis: Vec2<T>) -> Projection<T>
Project this line onto the provided axis.
Sourcepub fn project_point(&self, p: Vec2<T>) -> Vec2<T>
pub fn project_point(&self, p: Vec2<T>) -> Vec2<T>
Project the point onto this line.
Sourcepub fn raycast(&self, ray: &Ray<T>) -> Option<T>
pub fn raycast(&self, ray: &Ray<T>) -> Option<T>
Cast a ray against this line. If it intersects the line, return the distance along the ray that the intersection occurred.
pub fn transform_by(&self, f: impl FnMut(Vec2<T>) -> Vec2<T>) -> Self
Trait Implementations§
Source§impl<T> AbsDiffEq for Line<T>
impl<T> AbsDiffEq for Line<T>
Source§fn default_epsilon() -> Self::Epsilon
fn default_epsilon() -> Self::Epsilon
The default tolerance to use when testing values that are close together. Read more
Source§fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
A test for equality that uses the absolute difference to compute the approximate
equality of two numbers.
Source§fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
The inverse of
AbsDiffEq::abs_diff_eq.Source§impl<T: Copy + AddAssign<T>> AddAssign<&Vec2<T>> for Line<T>
impl<T: Copy + AddAssign<T>> AddAssign<&Vec2<T>> for Line<T>
Source§fn add_assign(&mut self, rhs: &Vec2<T>)
fn add_assign(&mut self, rhs: &Vec2<T>)
Performs the
+= operation. Read moreSource§impl<T: Copy + AddAssign<T>> AddAssign<Vec2<T>> for Line<T>
impl<T: Copy + AddAssign<T>> AddAssign<Vec2<T>> for Line<T>
Source§fn add_assign(&mut self, rhs: Vec2<T>)
fn add_assign(&mut self, rhs: Vec2<T>)
Performs the
+= operation. Read moreSource§impl<'de, T: Deserialize<'de>> Deserialize<'de> for Line<T>
impl<'de, T: Deserialize<'de>> Deserialize<'de> for Line<T>
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<T> From<(T, T, T, T)> for Line<T>
impl<T> From<(T, T, T, T)> for Line<T>
Source§fn from((x1, y1, x2, y2): (T, T, T, T)) -> Self
fn from((x1, y1, x2, y2): (T, T, T, T)) -> Self
Converts to this type from the input type.
Source§impl<T: Float> Interp for Line<T>
impl<T: Float> Interp for Line<T>
Source§fn quad_bezier(self, control: Self, target: Self, t: Self::Factor) -> Self
fn quad_bezier(self, control: Self, target: Self, t: Self::Factor) -> Self
Quadratic bezier interpolation.
Source§fn cubic_bezier(
self,
control1: Self,
control2: Self,
target: Self,
t: Self::Factor,
) -> Self
fn cubic_bezier( self, control1: Self, control2: Self, target: Self, t: Self::Factor, ) -> Self
Cubic bezier interpolation.
Source§fn hermite(
self,
tangent1: Self::Factor,
target: Self,
tangent2: Self::Factor,
t: Self::Factor,
) -> Self
fn hermite( self, tangent1: Self::Factor, target: Self, tangent2: Self::Factor, t: Self::Factor, ) -> Self
Cubic Hermite interpolation. Read more
Source§fn catmull_rom(
self,
control1: Self,
control2: Self,
target: Self,
t: Self::Factor,
) -> Self
fn catmull_rom( self, control1: Self, control2: Self, target: Self, t: Self::Factor, ) -> Self
Catmull-Rom interpolation. Read more
Source§fn smooth_step(self, target: Self, t: Self::Factor) -> Self
fn smooth_step(self, target: Self, t: Self::Factor) -> Self
Smooth-step interpolation. Read more
Source§impl<T: Numeric<AsU8 = u8, AsU16 = u16, AsU32 = u32, AsU64 = u64, AsU128 = u128, AsUSize = usize, AsI8 = i8, AsI16 = i16, AsI32 = i32, AsI64 = i64, AsI128 = i128, AsISize = isize, AsF32 = f32, AsF64 = f64>> Numeric for Line<T>
impl<T: Numeric<AsU8 = u8, AsU16 = u16, AsU32 = u32, AsU64 = u64, AsU128 = u128, AsUSize = usize, AsI8 = i8, AsI16 = i16, AsI32 = i32, AsI64 = i64, AsI128 = i128, AsISize = isize, AsF32 = f32, AsF64 = f64>> Numeric for Line<T>
type AsU8 = Line<u8>
type AsU16 = Line<u16>
type AsU32 = Line<u32>
type AsU64 = Line<u64>
type AsU128 = Line<u128>
type AsUSize = Line<usize>
type AsI8 = Line<i8>
type AsI16 = Line<i16>
type AsI32 = Line<i32>
type AsI64 = Line<i64>
type AsI128 = Line<i128>
type AsISize = Line<isize>
type AsF32 = Line<f32>
type AsF64 = Line<f64>
fn to_u8(self) -> Line<u8>
fn to_u16(self) -> Line<u16>
fn to_u32(self) -> Line<u32>
fn to_u64(self) -> Line<u64>
fn to_u128(self) -> Line<u128>
fn to_usize(self) -> Line<usize>
fn to_i8(self) -> Line<i8>
fn to_i16(self) -> Line<i16>
fn to_i32(self) -> Line<i32>
fn to_i64(self) -> Line<i64>
fn to_i128(self) -> Line<i128>
fn to_isize(self) -> Line<isize>
fn to_f32(self) -> Line<f32>
fn to_f64(self) -> Line<f64>
Source§impl<T: Ord> Ord for Line<T>
impl<T: Ord> Ord for Line<T>
Source§impl<T: PartialOrd> PartialOrd for Line<T>
impl<T: PartialOrd> PartialOrd for Line<T>
Source§impl<T> RelativeEq for Line<T>
impl<T> RelativeEq for Line<T>
Source§fn default_max_relative() -> Self::Epsilon
fn default_max_relative() -> Self::Epsilon
The default relative tolerance for testing values that are far-apart. Read more
Source§fn relative_eq(
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon,
) -> bool
fn relative_eq( &self, other: &Self, epsilon: Self::Epsilon, max_relative: Self::Epsilon, ) -> bool
A test for equality that uses a relative comparison if the values are far apart.
Source§fn relative_ne(
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon,
) -> bool
fn relative_ne( &self, other: &Rhs, epsilon: Self::Epsilon, max_relative: Self::Epsilon, ) -> bool
The inverse of
RelativeEq::relative_eq.Source§impl<T: Copy + SubAssign<T>> SubAssign<&Vec2<T>> for Line<T>
impl<T: Copy + SubAssign<T>> SubAssign<&Vec2<T>> for Line<T>
Source§fn sub_assign(&mut self, rhs: &Vec2<T>)
fn sub_assign(&mut self, rhs: &Vec2<T>)
Performs the
-= operation. Read moreSource§impl<T: Copy + SubAssign<T>> SubAssign<Vec2<T>> for Line<T>
impl<T: Copy + SubAssign<T>> SubAssign<Vec2<T>> for Line<T>
Source§fn sub_assign(&mut self, rhs: Vec2<T>)
fn sub_assign(&mut self, rhs: Vec2<T>)
Performs the
-= operation. Read moreSource§impl<T> UlpsEq for Line<T>
impl<T> UlpsEq for Line<T>
impl<T: Copy> Copy for Line<T>
impl<T: Eq> Eq for Line<T>
impl<T: Pod> Pod for Line<T>
impl<T> StructuralPartialEq for Line<T>
Auto Trait Implementations§
impl<T> Freeze for Line<T>where
T: Freeze,
impl<T> RefUnwindSafe for Line<T>where
T: RefUnwindSafe,
impl<T> Send for Line<T>where
T: Send,
impl<T> Sync for Line<T>where
T: Sync,
impl<T> Unpin for Line<T>where
T: Unpin,
impl<T> UnsafeUnpin for Line<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Line<T>where
T: UnwindSafe,
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
Mutably borrows from an owned value. Read more
Source§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
Source§type Bits = T
type Bits = T
Self must have the same layout as the specified Bits except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern.Source§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
If this function returns true, then it must be valid to reinterpret
bits
as &Self.