[−][src]Struct paddle::Vector
A 2D vector with single-precision floating point numbers
Fields
x: f32
The x coordinate of the vector
y: f32
The y coordinate of the vector
Implementations
impl Vector
[src]
pub const ZERO: Vector
[src]
A vector with x = 0, y = 0
pub const X: Vector
[src]
A vector with x = 1, y = 0
pub const Y: Vector
[src]
A vector with x = 0, y = 1
pub const ONE: Vector
[src]
A vector with x = 1, y = 1
impl Vector
[src]
pub fn new(x: impl Scalar, y: impl Scalar) -> Vector
[src]
Create a new vector
pub fn from_angle<T: Scalar>(angle: T) -> Vector
[src]
Create a unit vector at a given angle
pub fn len2(self) -> f32
[src]
Get the squared length of the vector (faster than getting the length)
pub fn len(self) -> f32
[src]
Get the length of the vector
#[must_use]pub fn clamp(
self,
min_bound: impl Into<Vector>,
max_bound: impl Into<Vector>
) -> Vector
[src]
self,
min_bound: impl Into<Vector>,
max_bound: impl Into<Vector>
) -> Vector
Clamp a vector somewhere between a minimum and a maximum
pub fn cross(self, other: impl Into<Vector>) -> f32
[src]
Get the cross product of a vector
pub fn dot(self, other: impl Into<Vector>) -> f32
[src]
Get the dot product of a vector
#[must_use]pub fn normalize(self) -> Vector
[src]
Normalize the vector's length from [0, 1]
#[must_use]pub fn x_comp(self) -> Vector
[src]
Get only the X component of the Vector, represented as a vector
#[must_use]pub fn y_comp(self) -> Vector
[src]
Get only the Y component of the Vector, represented as a vector
#[must_use]pub fn recip(self) -> Vector
[src]
Get the vector equal to Vector(1 / x, 1 / y)
#[must_use]pub fn times(self, other: impl Into<Vector>) -> Vector
[src]
Multiply the components in the matching places
pub fn angle(self) -> f32
[src]
Get the angle a vector forms with the positive x-axis, counter clockwise
#[must_use]pub fn with_len(self, length: f32) -> Vector
[src]
Create a vector with the same angle and the given length
pub fn distance(self, other: impl Into<Vector>) -> f32
[src]
Get the Euclidean distance to another vector
pub fn min(self, other: impl Into<Vector>) -> Vector
[src]
Get a vector with the minimum of each component of this and another vector
pub fn max(self, other: impl Into<Vector>) -> Vector
[src]
Get a vector with the maximum of each component of this and another vector
pub fn distance_2(&self, other: &Vector) -> f32
[src]
Trait Implementations
impl Add<Vector> for Vector
[src]
type Output = Vector
The resulting type after applying the +
operator.
pub fn add(self, rhs: Vector) -> Vector
[src]
impl AddAssign<Vector> for Vector
[src]
pub fn add_assign(&mut self, rhs: Vector)
[src]
impl Clone for Vector
[src]
impl Copy for Vector
[src]
impl Debug for Vector
[src]
impl Default for Vector
[src]
impl<'de> Deserialize<'de> for Vector
[src]
pub fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Display for Vector
[src]
impl Distribution<Vector> for Standard
[src]
pub fn sample<R: Rng + ?Sized>(&self, rand: &mut R) -> Vector
[src]
pub fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T> where
R: Rng,
[src]
R: Rng,
impl<T: Scalar> Div<T> for Vector
[src]
type Output = Vector
The resulting type after applying the /
operator.
pub fn div(self, rhs: T) -> Vector
[src]
impl<T: Scalar> DivAssign<T> for Vector
[src]
pub fn div_assign(&mut self, rhs: T)
[src]
impl Eq for Vector
[src]
impl<T: Scalar, U: Scalar> From<(T, U)> for Vector
[src]
impl<T: Scalar> Mul<T> for Vector
[src]
type Output = Vector
The resulting type after applying the *
operator.
pub fn mul(self, rhs: T) -> Vector
[src]
impl Mul<Transform> for Vector
[src]
type Output = Vector
The resulting type after applying the *
operator.
pub fn mul(self, t: Transform) -> Vector
[src]
impl Mul<Vector> for Transform
[src]
Transform a vector
type Output = Vector
The resulting type after applying the *
operator.
pub fn mul(self, other: Vector) -> Vector
[src]
impl<T: Scalar> MulAssign<T> for Vector
[src]
pub fn mul_assign(&mut self, rhs: T)
[src]
impl Neg for Vector
[src]
type Output = Vector
The resulting type after applying the -
operator.
pub fn neg(self) -> Vector
[src]
impl PartialEq<Vector> for Vector
[src]
pub fn eq(&self, other: &Vector) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl Serialize for Vector
[src]
pub fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl Shape for Vector
[src]
pub fn contains(&self, v: impl Into<Vector>) -> bool
[src]
pub fn overlaps(&self, shape: &impl Shape) -> bool
[src]
pub fn center(&self) -> Vector
[src]
pub fn bounding_box(&self) -> Rectangle
[src]
pub fn translate(&self, v: impl Into<Vector>) -> Vector
[src]
#[must_use]pub fn intersects(&self, line: &Line) -> bool
[src]
#[must_use]pub fn overlaps_circle(&self, circle: &Circle) -> bool
[src]
#[must_use]pub fn overlaps_rectangle(&self, rectangle: &Rectangle) -> bool
[src]
#[must_use]pub fn transformed_bounding_box(&self, transform: Transform) -> Rectangle
[src]
#[must_use]pub fn constrain(&self, outer: &Rectangle) -> Self where
Self: Sized,
[src]
Self: Sized,
#[must_use]pub fn with_center(&self, center: impl Into<Vector>) -> Self where
Self: Sized,
[src]
Self: Sized,
impl Sub<Vector> for Vector
[src]
type Output = Vector
The resulting type after applying the -
operator.
pub fn sub(self, rhs: Vector) -> Vector
[src]
impl SubAssign<Vector> for Vector
[src]
pub fn sub_assign(&mut self, rhs: Vector)
[src]
impl Tessellate for Vector
[src]
pub fn tessellate<'a>(&self, mesh: &mut AbstractMesh, bkg: Background<'a>)
[src]
Auto Trait Implementations
impl RefUnwindSafe for Vector
[src]
impl Send for Vector
[src]
impl Sync for Vector
[src]
impl Unpin for Vector
[src]
impl UnwindSafe for Vector
[src]
Blanket Implementations
impl<T> Activity for T where
T: Any,
[src]
T: Any,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,