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

source

pub fn new(x: f32, y: f32) -> Vector2F

source

pub fn splat(value: f32) -> Vector2F

source

pub fn zero() -> Vector2F

source

pub fn to_3d(self) -> Vector3F

source

pub fn to_4d(self) -> Vector4F

source

pub fn x(self) -> f32

source

pub fn y(self) -> f32

source

pub fn set_x(&mut self, x: f32)

source

pub fn set_y(&mut self, y: f32)

source

pub fn min(self, other: Vector2F) -> Vector2F

source

pub fn max(self, other: Vector2F) -> Vector2F

source

pub fn clamp(self, min_val: Vector2F, max_val: Vector2F) -> Vector2F

source

pub fn det(self, other: Vector2F) -> f32

source

pub fn dot(self, other: Vector2F) -> f32

source

pub fn floor(self) -> Vector2F

source

pub fn ceil(self) -> Vector2F

source

pub fn round(self) -> Vector2F

Rounds both coordinates to the nearest integer.

source

pub fn square_length(self) -> f32

Treats this point as a vector and calculates its squared length.

source

pub fn length(self) -> f32

Treats this point as a vector and calculates its length.

source

pub fn normalize(self) -> Vector2F

Treats this point as a vector and normalizes it.

source

pub fn yx(self) -> Vector2F

Swaps y and x.

source

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).

source

pub fn is_zero(self) -> bool

source

pub fn lerp(self, other: Vector2F, t: f32) -> Vector2F

source

pub fn to_i32(self) -> Vector2I

Trait Implementations§

source§

impl Add<Vector2F> for LineSegment2F

§

type Output = LineSegment2F

The resulting type after applying the + operator.
source§

fn add(self, point: Vector2F) -> LineSegment2F

Performs the + operation. Read more
source§

impl Add<Vector2F> for RectF

§

type Output = RectF

The resulting type after applying the + operator.
source§

fn add(self, other: Vector2F) -> RectF

Performs the + operation. Read more
source§

impl Add<f32> for Vector2F

§

type Output = Vector2F

The resulting type after applying the + operator.
source§

fn add(self, other: f32) -> Vector2F

Performs the + operation. Read more
source§

impl Add for Vector2F

§

type Output = Vector2F

The resulting type after applying the + operator.
source§

fn add(self, other: Vector2F) -> Vector2F

Performs the + operation. Read more
source§

impl AddAssign for Vector2F

source§

fn add_assign(&mut self, other: Vector2F)

Performs the += operation. Read more
source§

impl Clone for Vector2F

source§

fn clone(&self) -> Vector2F

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Vector2F

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Vector2F

source§

fn default() -> Vector2F

Returns the “default value” for a type. Read more
source§

impl Div<f32> for Vector2F

§

type Output = Vector2F

The resulting type after applying the / operator.
source§

fn div(self, other: f32) -> Vector2F

Performs the / operation. Read more
source§

impl Div for Vector2F

§

type Output = Vector2F

The resulting type after applying the / operator.
source§

fn div(self, other: Vector2F) -> Vector2F

Performs the / operation. Read more
source§

impl IntoVector2F for Vector2F

source§

impl Mul<Vector2F> for LineSegment2F

§

type Output = LineSegment2F

The resulting type after applying the * operator.
source§

fn mul(self, factors: Vector2F) -> LineSegment2F

Performs the * operation. Read more
source§

impl Mul<Vector2F> for Matrix2x2F

§

type Output = Vector2F

The resulting type after applying the * operator.
source§

fn mul(self, vector: Vector2F) -> Vector2F

Performs the * operation. Read more
source§

impl Mul<Vector2F> for Perspective

§

type Output = Vector2F

The resulting type after applying the * operator.
source§

fn mul(self, vector: Vector2F) -> Vector2F

Performs the * operation. Read more
source§

impl Mul<Vector2F> for RectF

§

type Output = RectF

The resulting type after applying the * operator.
source§

fn mul(self, factors: Vector2F) -> RectF

Performs the * operation. Read more
source§

impl Mul<Vector2F> for Transform2F

§

type Output = Vector2F

The resulting type after applying the * operator.
source§

fn mul(self, vector: Vector2F) -> Vector2F

Performs the * operation. Read more
source§

impl Mul<f32> for Vector2F

§

type Output = Vector2F

The resulting type after applying the * operator.
source§

fn mul(self, other: f32) -> Vector2F

Performs the * operation. Read more
source§

impl Mul for Vector2F

§

type Output = Vector2F

The resulting type after applying the * operator.
source§

fn mul(self, other: Vector2F) -> Vector2F

Performs the * operation. Read more
source§

impl MulAssign<Vector2F> for LineSegment2F

source§

fn mul_assign(&mut self, factors: Vector2F)

Performs the *= operation. Read more
source§

impl MulAssign<f32> for Vector2F

source§

fn mul_assign(&mut self, other: f32)

Performs the *= operation. Read more
source§

impl MulAssign for Vector2F

source§

fn mul_assign(&mut self, other: Vector2F)

Performs the *= operation. Read more
source§

impl Neg for Vector2F

§

type Output = Vector2F

The resulting type after applying the - operator.
source§

fn neg(self) -> Vector2F

Performs the unary - operation. Read more
source§

impl PartialEq for Vector2F

source§

fn eq(&self, other: &Vector2F) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Sub<Vector2F> for LineSegment2F

§

type Output = LineSegment2F

The resulting type after applying the - operator.
source§

fn sub(self, point: Vector2F) -> LineSegment2F

Performs the - operation. Read more
source§

impl Sub<Vector2F> for RectF

§

type Output = RectF

The resulting type after applying the - operator.
source§

fn sub(self, other: Vector2F) -> RectF

Performs the - operation. Read more
source§

impl Sub<f32> for Vector2F

§

type Output = Vector2F

The resulting type after applying the - operator.
source§

fn sub(self, other: f32) -> Vector2F

Performs the - operation. Read more
source§

impl Sub for Vector2F

§

type Output = Vector2F

The resulting type after applying the - operator.
source§

fn sub(self, other: Vector2F) -> Vector2F

Performs the - operation. Read more
source§

impl SubAssign for Vector2F

source§

fn sub_assign(&mut self, other: Vector2F)

Performs the -= operation. Read more
source§

impl Copy for Vector2F

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.