[−][src]Struct quicksilver::geom::Vector
A 2D vector with an arbitrary numeric type
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.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: f32, y: f32) -> Vector
[src]
Create a new vector
pub fn from_angle(angle: f32) -> 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: Vector, max_bound: Vector) -> Vector
[src]
Clamp a vector somewhere between a minimum and a maximum
pub fn cross(self, other: Vector) -> f32
[src]
Get the cross product of a vector
pub fn dot(self, other: 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: 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: Vector) -> f32
[src]
Get the Euclidean distance to another vector
pub fn min(self, other: Vector) -> Vector
[src]
Get a vector with the minimum of each component of this and another vector
pub fn max(self, other: Vector) -> Vector
[src]
Get a vector with the maximum of each component of this and another vector
Trait Implementations
impl Add<Vector> for Vector
[src]
type Output = Vector
The resulting type after applying the +
operator.
fn add(self, rhs: Vector) -> Vector
[src]
impl AddAssign<Vector> for Vector
[src]
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 Display for Vector
[src]
impl Div<f32> for Vector
[src]
type Output = Vector
The resulting type after applying the /
operator.
fn div(self, rhs: f32) -> Vector
[src]
impl DivAssign<f32> for Vector
[src]
fn div_assign(&mut self, rhs: f32)
[src]
impl Eq for Vector
[src]
impl From<(f32, f32)> for Vector
[src]
impl From<Vector> for Vector2<f32>
[src]
impl From<Vector2<f32>> for Vector
[src]
impl Mul<Vector> for Transform
[src]
Transform a vector
type Output = Vector
The resulting type after applying the *
operator.
fn mul(self, other: Vector) -> Vector
[src]
impl Mul<f32> for Vector
[src]
type Output = Vector
The resulting type after applying the *
operator.
fn mul(self, rhs: f32) -> Vector
[src]
impl MulAssign<f32> for Vector
[src]
fn mul_assign(&mut self, rhs: f32)
[src]
impl Neg for Vector
[src]
impl PartialEq<Vector> for Vector
[src]
impl Shape for Vector
[src]
fn contains(&self, v: Vector) -> bool
[src]
fn overlaps(&self, shape: &impl Shape) -> bool
[src]
fn center(&self) -> Vector
[src]
fn bounding_box(&self) -> Rectangle
[src]
fn translate(&self, v: Vector) -> Vector
[src]
#[must_use]fn intersects(&self, line: &Line) -> bool
[src]
#[must_use]fn overlaps_circle(&self, circle: &Circle) -> bool
[src]
#[must_use]fn overlaps_rectangle(&self, rectangle: &Rectangle) -> bool
[src]
#[must_use]fn transformed_bounding_box(&self, transform: Transform) -> Rectangle
[src]
#[must_use]fn constrain(&self, outer: &Rectangle) -> Self where
Self: Sized,
[src]
Self: Sized,
#[must_use]fn with_center(&self, center: Vector) -> Self where
Self: Sized,
[src]
Self: Sized,
impl Sub<Vector> for Vector
[src]
type Output = Vector
The resulting type after applying the -
operator.
fn sub(self, rhs: Vector) -> Vector
[src]
impl SubAssign<Vector> for Vector
[src]
fn sub_assign(&mut self, rhs: Vector)
[src]
impl Sum<Vector> for Vector
[src]
Auto Trait Implementations
impl RefUnwindSafe for Vector
impl Send for Vector
impl Sync for Vector
impl Unpin for Vector
impl UnwindSafe for Vector
Blanket Implementations
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,
fn borrow_mut(&mut self) -> &mut T
[src]
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.
fn to_owned(&self) -> T
[src]
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.
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>,