Struct pathfinder_geometry::vector::Vector2F
source · pub struct Vector2F(pub F32x2);
Expand description
2D points with 32-bit floating point coordinates.
Tuple Fields§
§0: F32x2
Implementations§
source§impl Vector2F
impl Vector2F
pub fn new(x: f32, y: f32) -> Vector2F
pub fn splat(value: f32) -> Vector2F
pub fn zero() -> Vector2F
pub fn to_3d(self) -> Vector3F
pub fn to_4d(self) -> Vector4F
pub fn x(self) -> f32
pub fn y(self) -> f32
pub fn set_x(&mut self, x: f32)
pub fn set_y(&mut self, y: f32)
pub fn min(self, other: Vector2F) -> Vector2F
pub fn max(self, other: Vector2F) -> Vector2F
pub fn clamp(self, min_val: Vector2F, max_val: Vector2F) -> Vector2F
pub fn det(self, other: Vector2F) -> f32
pub fn dot(self, other: Vector2F) -> f32
pub fn floor(self) -> Vector2F
pub fn ceil(self) -> Vector2F
sourcepub fn square_length(self) -> f32
pub fn square_length(self) -> f32
Treats this point as a vector and calculates its squared length.
sourcepub fn projection_coefficient(self, a: Vector2F) -> f32
pub fn projection_coefficient(self, a: Vector2F) -> f32
Returns the coefficient when the given vector a
is projected onto this one.
That is, if this vector is v
and this function returns c
, then proj_v a = cv
. In
other words, this function computes (a⋅v) / (v⋅v)
.
pub fn is_zero(self) -> bool
pub fn lerp(self, other: Vector2F, t: f32) -> Vector2F
pub fn to_i32(self) -> Vector2I
Trait Implementations§
source§impl Add<Vector2F> for LineSegment2F
impl Add<Vector2F> for LineSegment2F
§type Output = LineSegment2F
type Output = LineSegment2F
The resulting type after applying the
+
operator.source§impl AddAssign for Vector2F
impl AddAssign for Vector2F
source§fn add_assign(&mut self, other: Vector2F)
fn add_assign(&mut self, other: Vector2F)
Performs the
+=
operation. Read moresource§impl IntoVector2F for Vector2F
impl IntoVector2F for Vector2F
fn into_vector_2f(self) -> Vector2F
source§impl Mul<Vector2F> for LineSegment2F
impl Mul<Vector2F> for LineSegment2F
§type Output = LineSegment2F
type Output = LineSegment2F
The resulting type after applying the
*
operator.source§impl Mul<Vector2F> for Matrix2x2F
impl Mul<Vector2F> for Matrix2x2F
source§impl Mul<Vector2F> for Perspective
impl Mul<Vector2F> for Perspective
source§impl Mul<Vector2F> for Transform2F
impl Mul<Vector2F> for Transform2F
source§impl MulAssign<Vector2F> for LineSegment2F
impl MulAssign<Vector2F> for LineSegment2F
source§fn mul_assign(&mut self, factors: Vector2F)
fn mul_assign(&mut self, factors: Vector2F)
Performs the
*=
operation. Read moresource§impl MulAssign<f32> for Vector2F
impl MulAssign<f32> for Vector2F
source§fn mul_assign(&mut self, other: f32)
fn mul_assign(&mut self, other: f32)
Performs the
*=
operation. Read moresource§impl MulAssign for Vector2F
impl MulAssign for Vector2F
source§fn mul_assign(&mut self, other: Vector2F)
fn mul_assign(&mut self, other: Vector2F)
Performs the
*=
operation. Read moresource§impl PartialEq for Vector2F
impl PartialEq for Vector2F
source§impl Sub<Vector2F> for LineSegment2F
impl Sub<Vector2F> for LineSegment2F
§type Output = LineSegment2F
type Output = LineSegment2F
The resulting type after applying the
-
operator.source§impl SubAssign for Vector2F
impl SubAssign for Vector2F
source§fn sub_assign(&mut self, other: Vector2F)
fn sub_assign(&mut self, other: Vector2F)
Performs the
-=
operation. Read moreimpl Copy for Vector2F
Auto Trait Implementations§
impl Freeze for Vector2F
impl RefUnwindSafe for Vector2F
impl Send for Vector2F
impl Sync for Vector2F
impl Unpin for Vector2F
impl UnwindSafe for Vector2F
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