[−][src]Struct box2d_rs::b2_math::B2vec2
A 2D column vector.
Fields
x: f32
y: f32
Implementations
impl B2vec2
[src]
pub fn new(x_in: f32, y_in: f32) -> B2vec2
[src]
Construct using coordinates.
pub fn zero() -> B2vec2
[src]
pub fn set_zero(&mut self)
[src]
Set this vector to all zeros.
pub fn set(&mut self, x_: f32, y_: f32)
[src]
Set this vector to some specified coordinates.
pub fn get(self, i: i32) -> f32
[src]
pub fn set_by_index(&mut self, i: i32, value: f32)
[src]
pub fn length(self) -> f32
[src]
Get the length of this vector (the norm).
pub fn length_squared(self) -> f32
[src]
Get the length squared. For performance, use this instead of B2vec2::length (if possible).
pub fn normalize(&mut self) -> f32
[src]
Convert this vector into a unit vector. Returns the length.
pub fn is_valid(self) -> bool
[src]
Does this vector contain finite coordinates?
pub fn skew(self) -> B2vec2
[src]
Get the skew vector such that dot(skew_vec, other) == cross(vec, other)
Trait Implementations
impl Add<B2vec2> for B2vec2
[src]
type Output = B2vec2
The resulting type after applying the +
operator.
pub fn add(self, b: B2vec2) -> B2vec2
[src]
Add two vectors component-wise.
impl AddAssign<B2vec2> for B2vec2
[src]
pub fn add_assign(&mut self, other: B2vec2)
[src]
Add a vector to this vector.
impl Clone for B2vec2
[src]
impl Copy for B2vec2
[src]
impl Debug for B2vec2
[src]
impl Default for B2vec2
[src]
impl Mul<B2vec2> for f32
[src]
type Output = B2vec2
The resulting type after applying the *
operator.
pub fn mul(self, a: B2vec2) -> B2vec2
[src]
impl MulAssign<f32> for B2vec2
[src]
pub fn mul_assign(&mut self, other: f32)
[src]
Multiply this vector by a scalar.
impl Neg for B2vec2
[src]
type Output = B2vec2
The resulting type after applying the -
operator.
pub fn neg(self) -> B2vec2
[src]
Negate this vector.
impl PartialEq<B2vec2> for B2vec2
[src]
impl StructuralPartialEq for B2vec2
[src]
impl Sub<B2vec2> for B2vec2
[src]
type Output = B2vec2
The resulting type after applying the -
operator.
pub fn sub(self, b: B2vec2) -> B2vec2
[src]
Subtract two vectors component-wise.
impl SubAssign<B2vec2> for B2vec2
[src]
pub fn sub_assign(&mut self, other: B2vec2)
[src]
Subtract a vector from this vector.
Auto Trait Implementations
impl RefUnwindSafe for B2vec2
impl Send for B2vec2
impl Sync for B2vec2
impl Unpin for B2vec2
impl UnwindSafe for B2vec2
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,
pub 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.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
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>,