#[repr(transparent)]pub struct Quad<T>(pub [Vec2<T>; 4]);Expand description
A quad, represented by 4 points.
Tuple Fields§
§0: [Vec2<T>; 4]Implementations§
Source§impl<T: Copy + AbsDiffEq<Epsilon = T>> Quad<T>
impl<T: Copy + AbsDiffEq<Epsilon = T>> Quad<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>> Quad<T>
impl<T: Copy + RelativeEq<Epsilon = T>> Quad<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> Quad<T>
impl<T: Float> Quad<T>
Sourcepub fn line(line: impl Into<Line<T>>, width: T) -> Self
pub fn line(line: impl Into<Line<T>>, width: T) -> Self
Create a quad representing a “line segment” from start to
end, with the thickness of width. Useful for rendering.
Sourcepub fn stroke(line: impl Into<Line<T>>, start_width: T, end_width: T) -> Self
pub fn stroke(line: impl Into<Line<T>>, start_width: T, end_width: T) -> Self
Create a quad representing a “line segment” from start to
end, with the provided start and end thickness. Useful for rendering.
pub fn transform_by(&self, f: impl FnMut(Vec2<T>) -> Vec2<T>) -> Self
Trait Implementations§
Source§impl<T> AbsDiffEq for Quad<T>
impl<T> AbsDiffEq for Quad<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<'de, T> Deserialize<'de> for Quad<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Quad<T>where
T: Deserialize<'de>,
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: Float> Interp for Quad<T>
impl<T: Float> Interp for Quad<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 Quad<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 Quad<T>
type AsU8 = Quad<u8>
type AsU16 = Quad<u16>
type AsU32 = Quad<u32>
type AsU64 = Quad<u64>
type AsU128 = Quad<u128>
type AsUSize = Quad<usize>
type AsI8 = Quad<i8>
type AsI16 = Quad<i16>
type AsI32 = Quad<i32>
type AsI64 = Quad<i64>
type AsI128 = Quad<i128>
type AsISize = Quad<isize>
type AsF32 = Quad<f32>
type AsF64 = Quad<f64>
fn to_u8(self) -> Quad<u8>
fn to_u16(self) -> Quad<u16>
fn to_u32(self) -> Quad<u32>
fn to_u64(self) -> Quad<u64>
fn to_u128(self) -> Quad<u128>
fn to_usize(self) -> Quad<usize>
fn to_i8(self) -> Quad<i8>
fn to_i16(self) -> Quad<i16>
fn to_i32(self) -> Quad<i32>
fn to_i64(self) -> Quad<i64>
fn to_i128(self) -> Quad<i128>
fn to_isize(self) -> Quad<isize>
fn to_f32(self) -> Quad<f32>
fn to_f64(self) -> Quad<f64>
Source§impl<T: Ord> Ord for Quad<T>
impl<T: Ord> Ord for Quad<T>
Source§impl<T: PartialOrd> PartialOrd for Quad<T>
impl<T: PartialOrd> PartialOrd for Quad<T>
Source§impl<T> RelativeEq for Quad<T>
impl<T> RelativeEq for Quad<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> UlpsEq for Quad<T>
impl<T> UlpsEq for Quad<T>
impl<T: Copy> Copy for Quad<T>
impl<T: Eq> Eq for Quad<T>
impl<T: Pod> Pod for Quad<T>
impl<T> StructuralPartialEq for Quad<T>
Auto Trait Implementations§
impl<T> Freeze for Quad<T>where
T: Freeze,
impl<T> RefUnwindSafe for Quad<T>where
T: RefUnwindSafe,
impl<T> Send for Quad<T>where
T: Send,
impl<T> Sync for Quad<T>where
T: Sync,
impl<T> Unpin for Quad<T>where
T: Unpin,
impl<T> UnwindSafe for Quad<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.Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, S> Polygonal<T> for S
impl<T, S> Polygonal<T> for S
Source§fn nearest_vertex(&self, source: Vec2<T>) -> Vec2<T>
fn nearest_vertex(&self, source: Vec2<T>) -> Vec2<T>
Get the nearest point on this polygon to the source point.
Source§fn all_edges<F>(&self, cond: F) -> bool
fn all_edges<F>(&self, cond: F) -> bool
Iterate all polygonal edges of the shape, returning true if
any of them satisfy the conditional function provided.
Source§fn all_normals<F>(&self, cond: F) -> bool
fn all_normals<F>(&self, cond: F) -> bool
Iterate all edge normals of the shape, returning true if
any of them satisfy the conditional function provided.
Source§fn visit_normals<F>(&self, plot: F)
fn visit_normals<F>(&self, plot: F)
Walk through every normal of the polygon.
Source§fn visit_edges<F: FnMut(Line<T>)>(&self, plot: F)
fn visit_edges<F: FnMut(Line<T>)>(&self, plot: F)
Walk through every edge of the polygon.
Source§impl<T, S> Shape<T> for S
impl<T, S> Shape<T> for S
Source§fn project_onto_axis(&self, axis: Vec2<T>) -> Projection<T>
fn project_onto_axis(&self, axis: Vec2<T>) -> Projection<T>
Project the shape onto the axis.
Source§fn project_point(&self, p: Vec2<T>) -> Vec2<T>
fn project_point(&self, p: Vec2<T>) -> Vec2<T>
Project a point onto the outside surface of the shape.
Source§fn overlaps_rect(&self, rect: &Rect<T>) -> bool
fn overlaps_rect(&self, rect: &Rect<T>) -> bool
If this shape overlaps the rectangle.
Source§fn overlaps_circ(&self, circ: &Circle<T>) -> bool
fn overlaps_circ(&self, circ: &Circle<T>) -> bool
If this shape overlaps the circle.
Source§fn overlaps_poly<P>(&self, poly: &P) -> boolwhere
P: Polygonal<T>,
fn overlaps_poly<P>(&self, poly: &P) -> boolwhere
P: Polygonal<T>,
If this shape overlaps the polygon.
Source§fn extract_from_circ(&self, circ: &Circle<T>) -> Option<Vec2<T>>
fn extract_from_circ(&self, circ: &Circle<T>) -> Option<Vec2<T>>
If this shape and the circle overlap, return a push-out
vector that can be used to extract them from each other.