Struct flo_canvas::Coord2

source ·
pub struct Coord2(pub f64, pub f64);
Expand description

Represents a 2D point

Tuple Fields§

§0: f64§1: f64

Trait Implementations§

source§

impl Add<Coord2> for Coord2

§

type Output = Coord2

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl Clone for Coord2

source§

fn clone(&self) -> Coord2

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 Coordinate for Coord2

source§

fn from_components(components: &[f64]) -> Coord2

Creates a new coordinate from the specified set of components
source§

fn origin() -> Coord2

Returns the origin coordinate
source§

fn len() -> usize

The number of components in this coordinate
source§

fn get(&self, index: usize) -> f64

Retrieves the component at the specified index
source§

fn from_biggest_components(p1: Coord2, p2: Coord2) -> Coord2

Returns a point made up of the biggest components of the two points
source§

fn from_smallest_components(p1: Coord2, p2: Coord2) -> Coord2

Returns a point made up of the smallest components of the two points
source§

fn distance_to(&self, target: &Coord2) -> f64

Computes the distance between this coordinate and another of the same type
source§

fn dot(&self, target: &Coord2) -> f64

Computes the dot product for this vector along with another vector
source§

fn magnitude(&self) -> f64

Computes the magnitude of this vector
source§

fn to_unit_vector(&self) -> Self

Treating this as a vector, returns a unit vector in the same direction
source§

fn is_nan(&self) -> bool

Returns true if this coordinate has a NaN component
source§

fn round(self, accuracy: f64) -> Self

Round this coordinate so that it is accurate to a certain precision
source§

fn is_near_to(&self, other: &Self, max_distance: f64) -> bool

True if this point is within max_distance of another point
source§

fn smooth(points: &[Self], weights: &[f64]) -> Vec<Self, Global>

Generates a smoothed version of a set of coordinates, using the specified weights (weights should add up to 1.0). Read more
source§

impl Coordinate2D for Coord2

source§

fn x(&self) -> f64

X component of this coordinate

source§

fn y(&self) -> f64

Y component of this coordinate

source§

fn coords(&self) -> (f64, f64)

source§

impl Debug for Coord2

source§

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

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

impl From<(f32, f32)> for Coord2

source§

fn from(_: (f32, f32)) -> Coord2

Converts to this type from the input type.
source§

impl From<(f64, f64)> for Coord2

source§

fn from(_: (f64, f64)) -> Coord2

Converts to this type from the input type.
source§

impl Into<(f32, f32)> for Coord2

source§

fn into(self) -> (f32, f32)

Converts this type into the (usually inferred) input type.
source§

impl Into<(f64, f64)> for Coord2

source§

fn into(self) -> (f64, f64)

Converts this type into the (usually inferred) input type.
source§

impl Mul<f64> for Coord2

§

type Output = Coord2

The resulting type after applying the * operator.
source§

fn mul(self, rhs: f64) -> Coord2

Performs the * operation. Read more
source§

impl PartialEq<Coord2> for Coord2

source§

fn eq(&self, other: &Coord2) -> 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<Coord2> for Coord2

§

type Output = Coord2

The resulting type after applying the - operator.
source§

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

Performs the - operation. Read more
source§

impl Copy for Coord2

source§

impl StructuralPartialEq for Coord2

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> Coordinate2DExt for Twhere T: Coordinate + Coordinate2D,

source§

fn unit_vector_at_angle(radians: impl Into<f64>) -> T

Creates a unit vector at an angle in radians measured from the x-axis
source§

impl<T> CoordinateExt for Twhere T: Coordinate,

source§

fn unit_vector() -> T

Creates a unit vector along the x axis
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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<Point> Normalize for Pointwhere Point: Coordinate2D,

source§

fn to_normal(_point: &Point, tangent: &Point) -> Vec<f64, Global>

Computes the normal at a point, given its tangent
source§

impl<T> ToOwned for Twhere 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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.