Struct quicksilver::geom::Vector
[−]
[src]
pub struct Vector { pub x: f32, pub y: f32, }
A 2D vector with an arbitrary numeric type
Fields
x: f32
y: f32
Methods
impl Vector
[src]
fn zero() -> Vector
[src]
The zero vector
fn x() -> Vector
[src]
A vector with x = 1f32, y = 0f32
fn y() -> Vector
[src]
A vector with x = 0f32, y = 1f32
fn one() -> Vector
[src]
A vector with x = 1f32, y = 1f32
fn new(x: f32, y: f32) -> Vector
[src]
fn newi(x: i32, y: i32) -> Vector
[src]
fn from_angle(angle: f32) -> Vector
[src]
Create a unit vector at a given angle
fn len2(self) -> f32
[src]
Get the squared length of the vector (faster than getting the length)
fn len(self) -> f32
[src]
Get the length of the vector
fn clamp(self, min_bound: Vector, max_bound: Vector) -> Vector
[src]
Clamp a vector somewhere between a minimum and a maximum
fn cross(self, other: Vector) -> f32
[src]
Get the cross product of a vector
fn dot(self, other: Vector) -> f32
[src]
Get the dot product of a vector
fn normalize(self) -> Vector
[src]
Normalize the vector's length from [0, 1]
fn x_comp(self) -> Vector
[src]
Get only the X component of the Vector, represented as a vector
fn y_comp(self) -> Vector
[src]
Get only the Y component of the Vector, represented as a vector
fn recip(self) -> Vector
[src]
Get the vector equal to Vector(1 / x, 1 / y)
fn times(self, other: Vector) -> Vector
[src]
Multiply the components in the matching places
fn angle(self) -> f32
[src]
Get the angle a vector forms with the positive x-axis, counter clockwise
Trait Implementations
impl Copy for Vector
[src]
impl Clone for Vector
[src]
fn clone(&self) -> Vector
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Default for Vector
[src]
impl Debug for Vector
[src]
impl Neg for Vector
[src]
type Output = Vector
The resulting type after applying the -
operator.
fn neg(self) -> Vector
[src]
Performs the unary -
operation.
impl Add for Vector
[src]
type Output = Vector
The resulting type after applying the +
operator.
fn add(self, rhs: Vector) -> Vector
[src]
Performs the +
operation.
impl AddAssign for Vector
[src]
fn add_assign(&mut self, rhs: Vector)
[src]
Performs the +=
operation.
impl Sub for Vector
[src]
type Output = Vector
The resulting type after applying the -
operator.
fn sub(self, rhs: Vector) -> Vector
[src]
Performs the -
operation.
impl SubAssign for Vector
[src]
fn sub_assign(&mut self, rhs: Vector)
[src]
Performs the -=
operation.
impl Div<f32> for Vector
[src]
type Output = Vector
The resulting type after applying the /
operator.
fn div(self, rhs: f32) -> Vector
[src]
Performs the /
operation.
impl DivAssign<f32> for Vector
[src]
fn div_assign(&mut self, rhs: f32)
[src]
Performs the /=
operation.
impl Mul<f32> for Vector
[src]
type Output = Vector
The resulting type after applying the *
operator.
fn mul(self, rhs: f32) -> Vector
[src]
Performs the *
operation.
impl MulAssign<f32> for Vector
[src]
fn mul_assign(&mut self, rhs: f32)
[src]
Performs the *=
operation.
impl Div<i32> for Vector
[src]
type Output = Vector
The resulting type after applying the /
operator.
fn div(self, rhs: i32) -> Vector
[src]
Performs the /
operation.
impl DivAssign<i32> for Vector
[src]
fn div_assign(&mut self, rhs: i32)
[src]
Performs the /=
operation.
impl Mul<i32> for Vector
[src]
type Output = Vector
The resulting type after applying the *
operator.
fn mul(self, rhs: i32) -> Vector
[src]
Performs the *
operation.
impl MulAssign<i32> for Vector
[src]
fn mul_assign(&mut self, rhs: i32)
[src]
Performs the *=
operation.
impl PartialEq for Vector
[src]
fn eq(&self, other: &Vector) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl Eq for Vector
[src]
impl Display for Vector
[src]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more