Struct collider::geom::DirVec2
[−]
[src]
pub struct DirVec2 { /* fields omitted */ }
A 2-D vector that separates direction from length.
This may be used rather than Vec2
if the length
may be at or near 0.0
but the direction is still important,
or to distinguish between a vector with a negative length
and a vector in the opposite direction of positive length.
Such distinctions are necessary when describing the
normal distance between PlacedShape
s.
Methods
impl DirVec2
[src]
pub fn new(dir: Vec2, len: f64) -> DirVec2
[src]
Constructs a vector with the given direction dir
and length len
.
dir
is normalized before being set.
pub fn dir(&self) -> Vec2
[src]
Returns the direction as a unit vector.
pub fn len(&self) -> f64
[src]
Returns the length of the vector. May be positive or negative.
pub fn flip(&self) -> DirVec2
[src]
Returns a new vector with the same len
but reversed dir
.
Trait Implementations
impl PartialEq for DirVec2
[src]
fn eq(&self, __arg_0: &DirVec2) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &DirVec2) -> bool
[src]
This method tests for !=
.
impl Copy for DirVec2
[src]
impl Clone for DirVec2
[src]
fn clone(&self) -> DirVec2
[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 Debug for DirVec2
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more