Struct vodk_math::vec2::Vector2D
[−]
[src]
pub struct Vector2D<Unit = Untyped> { pub x: f32, pub y: f32, // some fields omitted }
Fields
x: f32
y: f32
Methods
impl<U> Vector2D<U>
[src]
fn new(x: f32, y: f32) -> Vector2D<U>
fn from_slice(from: &[f32]) -> Vector2D<U>
fn as_slice<'l>(&'l self) -> &'l [f32]
fn as_mut_slice<'l>(&'l mut self) -> &'l mut [f32]
fn array(&self) -> [f32; 2]
fn tuple(&self) -> (f32, f32)
fn from_array(array: [f32; 2]) -> Vector2D<U>
fn from_tuple(tuple: (f32, f32)) -> Vector2D<U>
fn dot(&self, rhs: &Vector2D<U>) -> f32
fn cross(&self, rhs: Vector2D<U>) -> f32
fn length(&self) -> f32
fn square_length(&self) -> f32
fn normalized(&self) -> Vector2D<U>
fn xy(&self) -> Vector2D<U>
fn yx(&self) -> Vector2D<U>
fn directed_angle(self, other: Vector2D<U>) -> f32
Angle between vectors v1 and v2 (oriented clockwise assyming y points downwards). The result is a number between 0 and 2*PI.
ex: directed_angle([0,1], [1,0]) = 3/2 Pi rad x __ 0--> / \ y| | x--> v2 v \ |v1 v
Or, assuming y points upwards: directed_angle([0,-1], [1,0]) = 1/2 Pi rad
^ v2 y| x--> 0--> v1 | / x v-
fn directed_angle2(self, a: Vector2D<U>, b: Vector2D<U>) -> f32
fn fuzzy_eq(self, rhs: Vector2D<U>) -> bool
Trait Implementations
impl<U> AsRef<[f32; 2]> for Vector2D<U>
[src]
impl<U> AsRef<(f32, f32)> for Vector2D<U>
[src]
impl<U> AsMut<[f32; 2]> for Vector2D<U>
[src]
impl<U> AsMut<(f32, f32)> for Vector2D<U>
[src]
impl<U> From<[f32; 2]> for Vector2D<U>
[src]
impl<U> From<(f32, f32)> for Vector2D<U>
[src]
impl<U> Default for Vector2D<U>
[src]
impl<U> Add<Vector2D<U>> for Vector2D<U>
[src]
type Output = Vector2D<U>
The resulting type after applying the +
operator
fn add(self, rhs: Vector2D<U>) -> Vector2D<U>
The method for the +
operator
impl<U> Sub<Vector2D<U>> for Vector2D<U>
[src]
type Output = Vector2D<U>
The resulting type after applying the -
operator
fn sub(self, rhs: Vector2D<U>) -> Vector2D<U>
The method for the -
operator
impl<U> Mul<Vector2D<U>> for Vector2D<U>
[src]
type Output = Vector2D<U>
The resulting type after applying the *
operator
fn mul(self, rhs: Vector2D<U>) -> Vector2D<U>
The method for the *
operator
impl<U> Mul<f32> for Vector2D<U>
[src]
type Output = Vector2D<U>
The resulting type after applying the *
operator
fn mul(self, rhs: f32) -> Vector2D<U>
The method for the *
operator
impl<U> Div<Vector2D<U>> for Vector2D<U>
[src]
type Output = Vector2D<U>
The resulting type after applying the /
operator
fn div(self, rhs: Vector2D<U>) -> Vector2D<U>
The method for the /
operator
impl<U> Div<f32> for Vector2D<U>
[src]
type Output = Vector2D<U>
The resulting type after applying the /
operator
fn div(self, rhs: f32) -> Vector2D<U>
The method for the /
operator
impl<U> Neg for Vector2D<U>
[src]
type Output = Vector2D<U>
The resulting type after applying the -
operator
fn neg(self) -> Vector2D<U>
The method for the unary -
operator
impl<U: Unit> Debug for Vector2D<U>
[src]
impl<U> Copy for Vector2D<U>
[src]
impl<U> Clone for Vector2D<U>
[src]
fn clone(&self) -> Vector2D<U>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more