Struct nbez::Vector2d
[−]
[src]
pub struct Vector2d<F: Float> { pub x: F, pub y: F, }
2-dimensional vector
Fields
x: F
y: F
Methods
impl<F: Float> Vector2d<F>
[src]
fn new(x: F, y: F) -> Vector2d<F>
Convenience method for creating a new instance of this struct. Fields of this function correspond to fields of the struct.
impl<F: Float> Vector2d<F>
[src]
fn len(self) -> F
Get the length of this vector, with the Pythagorean theorem
fn normalize(self) -> Vector2d<F>
Return a vector that points in the same direction as self
, but has a length of one.
impl<F: Float> Vector2d<F>
[src]
fn perp(self) -> Vector2d<F>
Returns a vector perpendicular to self
. Currently only implemented for 2-dimensional vectors.
Trait Implementations
impl<F: Hash + Float> Hash for Vector2d<F>
[src]
fn hash<__HF: Hasher>(&self, __arg_0: &mut __HF)
Feeds this value into the state given, updating the hasher as necessary.
fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher
1.3.0
Feeds a slice of this type into the state provided.
impl<F: Ord + Float> Ord for Vector2d<F>
[src]
fn cmp(&self, __arg_0: &Vector2d<F>) -> Ordering
This method returns an Ordering
between self
and other
. Read more
impl<F: PartialOrd + Float> PartialOrd for Vector2d<F>
[src]
fn partial_cmp(&self, __arg_0: &Vector2d<F>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &Vector2d<F>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &Vector2d<F>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, __arg_0: &Vector2d<F>) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &Vector2d<F>) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<F: Eq + Float> Eq for Vector2d<F>
[src]
impl<F: PartialEq + Float> PartialEq for Vector2d<F>
[src]
fn eq(&self, __arg_0: &Vector2d<F>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Vector2d<F>) -> bool
This method tests for !=
.
impl<F: Copy + Float> Copy for Vector2d<F>
[src]
impl<F: Clone + Float> Clone for Vector2d<F>
[src]
fn clone(&self) -> Vector2d<F>
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
impl<F: Debug + Float> Debug for Vector2d<F>
[src]
impl<F: Default + Float> Default for Vector2d<F>
[src]
impl<F: Float> From<[F; 2]> for Vector2d<F>
[src]
impl<F: Float> Into<[F; 2]> for Vector2d<F>
[src]
impl<F: Float> Into<(F, F)> for Vector2d<F>
[src]
impl<F: Float> From<Point2d<F>> for Vector2d<F>
[src]
impl<F: Float> AsRef<[F]> for Vector2d<F>
[src]
impl<F: Float> AsMut<[F]> for Vector2d<F>
[src]
impl<F: Float> Zero for Vector2d<F>
[src]
fn zero() -> Vector2d<F>
Returns the additive identity element of Self
, 0
. Read more
fn is_zero(&self) -> bool
Returns true
if self
is equal to the additive identity.
impl<F: Float> One for Vector2d<F>
[src]
impl<F: Float> Add<Point2d<F>> for Vector2d<F>
[src]
type Output = Vector2d<F>
The resulting type after applying the +
operator
fn add(self, rhs: Point2d<F>) -> Vector2d<F>
The method for the +
operator
impl<F: Float> Sub<Point2d<F>> for Vector2d<F>
[src]
type Output = Vector2d<F>
The resulting type after applying the -
operator
fn sub(self, rhs: Point2d<F>) -> Vector2d<F>
The method for the -
operator
impl<F: Float> Mul<Point2d<F>> for Vector2d<F>
[src]
type Output = Vector2d<F>
The resulting type after applying the *
operator
fn mul(self, rhs: Point2d<F>) -> Vector2d<F>
The method for the *
operator
impl<F: Float> Div<Point2d<F>> for Vector2d<F>
[src]
type Output = Vector2d<F>
The resulting type after applying the /
operator
fn div(self, rhs: Point2d<F>) -> Vector2d<F>
The method for the /
operator
impl<F: Float> Add<Vector2d<F>> for Vector2d<F>
[src]
type Output = Vector2d<F>
The resulting type after applying the +
operator
fn add(self, rhs: Vector2d<F>) -> Vector2d<F>
The method for the +
operator
impl<F: Float> Sub<Vector2d<F>> for Vector2d<F>
[src]
type Output = Vector2d<F>
The resulting type after applying the -
operator
fn sub(self, rhs: Vector2d<F>) -> Vector2d<F>
The method for the -
operator
impl<F: Float> Mul<Vector2d<F>> for Vector2d<F>
[src]
type Output = Vector2d<F>
The resulting type after applying the *
operator
fn mul(self, rhs: Vector2d<F>) -> Vector2d<F>
The method for the *
operator
impl<F: Float> Div<Vector2d<F>> for Vector2d<F>
[src]
type Output = Vector2d<F>
The resulting type after applying the /
operator
fn div(self, rhs: Vector2d<F>) -> Vector2d<F>
The method for the /
operator
impl<F: Float> Mul<F> for Vector2d<F>
[src]
type Output = Vector2d<F>
The resulting type after applying the *
operator
fn mul(self, rhs: F) -> Vector2d<F>
The method for the *
operator
impl<F: Float> Div<F> for Vector2d<F>
[src]
type Output = Vector2d<F>
The resulting type after applying the /
operator
fn div(self, rhs: F) -> Vector2d<F>
The method for the /
operator
impl<F: Float> Neg for Vector2d<F>
[src]
type Output = Vector2d<F>
The resulting type after applying the -
operator
fn neg(self) -> Vector2d<F>
The method for the unary -
operator