zeno

Type Alias Point

Source
pub type Point = Vector;
Expand description

Alias for vector to distinguish intended use.

Aliased Type§

struct Point {
    pub x: f32,
    pub y: f32,
}

Fields§

§x: f32§y: f32

Implementations

Source§

impl Vector

Source

pub const ZERO: Self

Vector with both components set to zero.

Source

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

Creates a new vector with the specified coordinates.

Source

pub fn length(self) -> f32

Returns the length of the vector.

Source

pub fn length_squared(self) -> f32

Returns the squared length of the vector.

Source

pub fn distance_to(self, other: Self) -> f32

Returns the distance between two points.

Source

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

Computes the dot product of two vectors.

Source

pub fn cross(self, other: Self) -> f32

Computes the cross product of two vectors.

Source

pub fn normalize(self) -> Self

Returns a normalized copy of the vector.

Source

pub fn ceil(self) -> Self

Returns a new vector containing the smallest integer values greater than or equal to each component.

Source

pub fn floor(self) -> Self

Returns a new vector containing the largest integer values less than or equal to each component.

Source

pub fn angle_to(self, other: Self) -> Angle

Returns the angle to the specified vector.

Source

pub fn nearly_eq(self, other: Vector) -> bool

Returns true if this vector is approximately equal to other using a standard single precision epsilon value.

Source

pub fn nearly_eq_by(self, other: Vector, epsilon: f32) -> bool

Returns true if this vector is approximately equal to other using the specified epsilon value.

Trait Implementations

Source§

impl Add for Vector

Source§

type Output = Vector

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self

Performs the + operation. Read more
Source§

impl Clone for Vector

Source§

fn clone(&self) -> Vector

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 Vector

Source§

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

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

impl Default for Vector

Source§

fn default() -> Vector

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

impl Div<f32> for Vector

Source§

type Output = Vector

The resulting type after applying the / operator.
Source§

fn div(self, rhs: f32) -> Self

Performs the / operation. Read more
Source§

impl Div for Vector

Source§

type Output = Vector

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Self) -> Self

Performs the / operation. Read more
Source§

impl From<[f32; 2]> for Vector

Source§

fn from(v: [f32; 2]) -> Self

Converts to this type from the input type.
Source§

impl From<[i32; 2]> for Vector

Source§

fn from(v: [i32; 2]) -> Self

Converts to this type from the input type.
Source§

impl From<(f32, f32)> for Vector

Source§

fn from(v: (f32, f32)) -> Self

Converts to this type from the input type.
Source§

impl From<(f32, i32)> for Vector

Source§

fn from(v: (f32, i32)) -> Self

Converts to this type from the input type.
Source§

impl From<(i32, f32)> for Vector

Source§

fn from(v: (i32, f32)) -> Self

Converts to this type from the input type.
Source§

impl From<(i32, i32)> for Vector

Source§

fn from(v: (i32, i32)) -> Self

Converts to this type from the input type.
Source§

impl From<f32> for Vector

Source§

fn from(x: f32) -> Self

Converts to this type from the input type.
Source§

impl From<i32> for Vector

Source§

fn from(x: i32) -> Self

Converts to this type from the input type.
Source§

impl Mul<f32> for Vector

Source§

type Output = Vector

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: f32) -> Self

Performs the * operation. Read more
Source§

impl Mul for Vector

Source§

type Output = Vector

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Self) -> Self

Performs the * operation. Read more
Source§

impl PartialEq for Vector

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Sub for Vector

Source§

type Output = Vector

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self

Performs the - operation. Read more
Source§

impl Copy for Vector

Source§

impl StructuralPartialEq for Vector