#[repr(C)]pub struct Vector2 {
pub x: f32,
pub y: f32,
}Fields§
§x: f32§y: f32Implementations§
Source§impl Vector2
impl Vector2
Sourcepub fn add_value(self, add: f32) -> Self
pub fn add_value(self, add: f32) -> Self
Add scalar to both components. (raymath Vector2AddValue)
Sourcepub fn sub_value(self, sub: f32) -> Self
pub fn sub_value(self, sub: f32) -> Self
Subtract scalar from both components. (raymath Vector2SubtractValue)
Sourcepub fn length_sqr(self) -> f32
pub fn length_sqr(self) -> f32
Squared vector length. (raymath Vector2LengthSqr)
Sourcepub fn cross(self, other: Vector2) -> f32
pub fn cross(self, other: Vector2) -> f32
Cross product (scalar). (raymath Vector2CrossProduct)
Sourcepub fn distance(self, other: Vector2) -> f32
pub fn distance(self, other: Vector2) -> f32
Distance between two vectors. (raymath Vector2Distance)
Sourcepub fn distance_sqr(self, other: Vector2) -> f32
pub fn distance_sqr(self, other: Vector2) -> f32
Squared distance between two vectors. (raymath Vector2DistanceSqr)
Sourcepub fn angle(self, other: Vector2) -> f32
pub fn angle(self, other: Vector2) -> f32
Angle between two vectors (radians). (raymath Vector2Angle)
Sourcepub fn line_angle(start: Vector2, end: Vector2) -> f32
pub fn line_angle(start: Vector2, end: Vector2) -> f32
Angle of line defined by two points. (raymath Vector2LineAngle)
Sourcepub fn multiply(self, other: Vector2) -> Self
pub fn multiply(self, other: Vector2) -> Self
Component-wise multiply. (raymath Vector2Multiply)
Sourcepub fn lerp(self, other: Vector2, amount: f32) -> Self
pub fn lerp(self, other: Vector2, amount: f32) -> Self
Linear interpolation. (raymath Vector2Lerp)
Sourcepub fn reflect(self, normal: Vector2) -> Self
pub fn reflect(self, normal: Vector2) -> Self
Reflect vector about normal. (raymath Vector2Reflect)
Sourcepub fn move_towards(self, target: Vector2, max_distance: f32) -> Self
pub fn move_towards(self, target: Vector2, max_distance: f32) -> Self
Move towards target by at most maxDistance. (raymath Vector2MoveTowards)
Sourcepub fn clamp(self, min: Vector2, max: Vector2) -> Self
pub fn clamp(self, min: Vector2, max: Vector2) -> Self
Clamp components between min and max vectors. (raymath Vector2Clamp)
Sourcepub fn clamp_value(self, min: f32, max: f32) -> Self
pub fn clamp_value(self, min: f32, max: f32) -> Self
Clamp length between min and max scalars. (raymath Vector2ClampValue)
Trait Implementations§
Source§impl AddAssign for Vector2
impl AddAssign for Vector2
Source§fn add_assign(&mut self, rhs: Vector2)
fn add_assign(&mut self, rhs: Vector2)
+= operation. Read moreimpl Copy for Vector2
Source§impl MulAssign<f32> for Vector2
impl MulAssign<f32> for Vector2
Source§fn mul_assign(&mut self, rhs: f32)
fn mul_assign(&mut self, rhs: f32)
*= operation. Read more