pub struct FreeVector2D { /* private fields */ }Expand description
Concrete 2D free-vector implementation whose stored coordinates may be Cartesian or polar.
Implementations§
Source§impl FreeVector2D
impl FreeVector2D
Sourcepub fn new(x: GeometryMeasure, y: GeometryMeasure) -> Self
pub fn new(x: GeometryMeasure, y: GeometryMeasure) -> Self
Creates a vector from Cartesian x and y components.
Sourcepub fn new_in_system(
first: GeometryMeasure,
second: GeometryMeasure,
coordinate_system: CoordinateSystem2D,
) -> Self
pub fn new_in_system( first: GeometryMeasure, second: GeometryMeasure, coordinate_system: CoordinateSystem2D, ) -> Self
Creates a vector from raw coordinates in the specified system.
Sourcepub fn raw_components(&self) -> [GeometryMeasure; 2]
pub fn raw_components(&self) -> [GeometryMeasure; 2]
Returns the raw stored coordinates in the currently declared coordinate system.
Sourcepub fn cartesian_components(&self) -> [GeometryMeasure; 2]
pub fn cartesian_components(&self) -> [GeometryMeasure; 2]
Returns the Cartesian [x, y] representation of this vector.
Sourcepub fn coordinate_system(&self) -> CoordinateSystem2D
pub fn coordinate_system(&self) -> CoordinateSystem2D
Returns the current coordinate system.
Sourcepub fn set_coordinate_system(&mut self, coordinate_system: CoordinateSystem2D)
pub fn set_coordinate_system(&mut self, coordinate_system: CoordinateSystem2D)
Converts the stored coordinates to coordinate_system if needed.
Sourcepub fn converted_to(&self, coordinate_system: CoordinateSystem2D) -> Self
pub fn converted_to(&self, coordinate_system: CoordinateSystem2D) -> Self
Returns a copy represented in the requested coordinate system.
Sourcepub fn x(&self) -> GeometryMeasure
pub fn x(&self) -> GeometryMeasure
Returns the Cartesian x-component.
Sourcepub fn y(&self) -> GeometryMeasure
pub fn y(&self) -> GeometryMeasure
Returns the Cartesian y-component.
Trait Implementations§
Source§impl Add for FreeVector2D
impl Add for FreeVector2D
Source§impl Add<FreeVector2D> for CoordinateVector2D
impl Add<FreeVector2D> for CoordinateVector2D
Source§type Output = CoordinateVector2D
type Output = CoordinateVector2D
The resulting type after applying the
+ operator.Source§impl Add<f32> for FreeVector2D
impl Add<f32> for FreeVector2D
Source§type Output = FreeVector2D
type Output = FreeVector2D
The resulting type after applying the
+ operator.Source§impl AsMut<f32> for FreeVector2D
impl AsMut<f32> for FreeVector2D
Source§fn as_mut(&mut self) -> &mut GeometryMeasure
fn as_mut(&mut self) -> &mut GeometryMeasure
Converts this type into a mutable reference of the (usually inferred) input type.
Source§impl AsRef<f32> for FreeVector2D
impl AsRef<f32> for FreeVector2D
Source§fn as_ref(&self) -> &GeometryMeasure
fn as_ref(&self) -> &GeometryMeasure
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl CanNormalize for FreeVector2D
impl CanNormalize for FreeVector2D
Source§impl CanScale for FreeVector2D
impl CanScale for FreeVector2D
Source§fn scale(&mut self, factor: GeometryMeasure)
fn scale(&mut self, factor: GeometryMeasure)
Applies a uniform scaling factor.
Source§impl CanScaleNonUniform for FreeVector2D
impl CanScaleNonUniform for FreeVector2D
Source§type ScaleVector = FreeVector2D
type ScaleVector = FreeVector2D
Primitive used to represent non-uniform scale factors.
Source§fn scale_non_uniform(&mut self, factors: &Self::ScaleVector)
fn scale_non_uniform(&mut self, factors: &Self::ScaleVector)
Applies non-uniform scaling in place.
Source§impl Clone for FreeVector2D
impl Clone for FreeVector2D
impl CoordinatePrimitive for FreeVector2D
impl Copy for FreeVector2D
Source§impl Debug for FreeVector2D
impl Debug for FreeVector2D
Source§impl Display for FreeVector2D
impl Display for FreeVector2D
Source§impl Div<f32> for FreeVector2D
impl Div<f32> for FreeVector2D
Source§type Output = FreeVector2D
type Output = FreeVector2D
The resulting type after applying the
/ operator.Source§impl DotProduct for FreeVector2D
impl DotProduct for FreeVector2D
impl Eq for FreeVector2D
impl GeometricPrimitive for FreeVector2D
impl GeometricPrimitive2D for FreeVector2D
Source§impl HasDimension for FreeVector2D
impl HasDimension for FreeVector2D
Source§impl HasNorm for FreeVector2D
impl HasNorm for FreeVector2D
Source§fn norm(&self) -> GeometryMeasure
fn norm(&self) -> GeometryMeasure
Returns the norm.
Source§impl Hash for FreeVector2D
impl Hash for FreeVector2D
Source§impl Index<usize> for FreeVector2D
impl Index<usize> for FreeVector2D
Source§impl IndexMut<usize> for FreeVector2D
impl IndexMut<usize> for FreeVector2D
Source§impl Mul for FreeVector2D
impl Mul for FreeVector2D
Source§impl Mul<f32> for FreeVector2D
impl Mul<f32> for FreeVector2D
Source§type Output = FreeVector2D
type Output = FreeVector2D
The resulting type after applying the
* operator.Source§impl Normalize for FreeVector2D
impl Normalize for FreeVector2D
Source§fn normalized(&self) -> Self
fn normalized(&self) -> Self
Returns a normalized copy of
self.Source§impl PartialEq for FreeVector2D
impl PartialEq for FreeVector2D
impl ScalarOperable for FreeVector2D
impl SelfAddition for FreeVector2D
impl SelfProductInner for FreeVector2D
impl StructuralPartialEq for FreeVector2D
Source§impl Sub for FreeVector2D
impl Sub for FreeVector2D
Source§impl Sub<FreeVector2D> for CoordinateVector2D
impl Sub<FreeVector2D> for CoordinateVector2D
Source§type Output = CoordinateVector2D
type Output = CoordinateVector2D
The resulting type after applying the
- operator.Source§impl Sub<f32> for FreeVector2D
impl Sub<f32> for FreeVector2D
Source§type Output = FreeVector2D
type Output = FreeVector2D
The resulting type after applying the
- operator.Source§impl ToCartesian for FreeVector2D
impl ToCartesian for FreeVector2D
Source§type Cartesian = FreeVector2D
type Cartesian = FreeVector2D
Cartesian result type.
Source§fn to_cartesian(&self) -> Self::Cartesian
fn to_cartesian(&self) -> Self::Cartesian
Returns the Cartesian representation of
self.Auto Trait Implementations§
impl Freeze for FreeVector2D
impl RefUnwindSafe for FreeVector2D
impl Send for FreeVector2D
impl Sync for FreeVector2D
impl Unpin for FreeVector2D
impl UnsafeUnpin for FreeVector2D
impl UnwindSafe for FreeVector2D
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more