pub struct Vector2 {
pub x: f64,
pub y: f64,
}Expand description
Represents a 2D point in space.
Fields§
§x: f64§y: f64Implementations§
Source§impl Vector2
impl Vector2
Sourcepub fn min() -> Self
👎Deprecated
pub fn min() -> Self
Create a 2D point struct using f64::MIN for x and y coordinates.
Sourcepub fn max() -> Self
👎Deprecated
pub fn max() -> Self
Create a 2D point struct using f64::MAX for x and y coordinates.
Sourcepub fn distance_to(&self, to: Self) -> f64
pub fn distance_to(&self, to: Self) -> f64
Calculate the distance to another Vector2 struct.
Sourcepub fn angle_degrees(&self) -> f64
pub fn angle_degrees(&self) -> f64
Computes the angle in degrees with respect to the positive x-axis.
Sourcepub fn add_x(&self, value: f64) -> Self
pub fn add_x(&self, value: f64) -> Self
Returns a new Vector2 incrementing the x coordinate by the given value.
Sourcepub fn add_y(&self, value: f64) -> Self
pub fn add_y(&self, value: f64) -> Self
Returns a new Vector2 incrementing the y coordinate by the given value.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Vector2
impl<'de> Deserialize<'de> for Vector2
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Copy for Vector2
impl StructuralPartialEq for Vector2
Auto Trait Implementations§
impl Freeze for Vector2
impl RefUnwindSafe for Vector2
impl Send for Vector2
impl Sync for Vector2
impl Unpin for Vector2
impl UnwindSafe for Vector2
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