Struct crystal_ball::math::Point2

source ·
pub struct Point2 {
    pub x: f64,
    pub y: f64,
}
Expand description

A 2-dimensional point.

Fields§

§x: f64§y: f64

Implementations§

source§

impl Point2

source

pub const ZERO: Point2 = _

source

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

Create a new Point2.

source

pub fn splat(value: f64) -> Self

Create a new Point2 with all elements set to value.

source

pub fn to_vec2(&self) -> Vec2

Convert the Point2 to a Vec2.

Trait Implementations§

source§

impl Add<Vec2> for Point2

§

type Output = Point2

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl Add for Point2

§

type Output = Point2

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl AddAssign<Vec2> for Point2

source§

fn add_assign(&mut self, rhs: Vec2)

Performs the += operation. Read more
source§

impl AddAssign for Point2

source§

fn add_assign(&mut self, rhs: Point2)

Performs the += operation. Read more
source§

impl Clone for Point2

source§

fn clone(&self) -> Point2

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 Point2

source§

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

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

impl Default for Point2

source§

fn default() -> Point2

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

impl Div<f64> for Point2

§

type Output = Point2

The resulting type after applying the / operator.
source§

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

Performs the / operation. Read more
source§

impl DivAssign<f64> for Point2

source§

fn div_assign(&mut self, rhs: f64)

Performs the /= operation. Read more
source§

impl From<[f64; 3]> for Point2

source§

fn from(s: [f64; 3]) -> Self

Converts to this type from the input type.
source§

impl From<(f64, f64, f64)> for Point2

source§

fn from(t: (f64, f64, f64)) -> Self

Converts to this type from the input type.
source§

impl From<Point2> for Vec2

source§

fn from(p: Point2) -> Self

Converts to this type from the input type.
source§

impl From<Vec2> for Point2

source§

fn from(v: Vec2) -> Self

Converts to this type from the input type.
source§

impl Index<usize> for Point2

§

type Output = f64

The returned type after indexing.
source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl IndexMut<usize> for Point2

source§

fn index_mut(&mut self, index: usize) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
source§

impl Mul<Point2> for f64

§

type Output = Point2

The resulting type after applying the * operator.
source§

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

Performs the * operation. Read more
source§

impl Mul<f64> for Point2

§

type Output = Point2

The resulting type after applying the * operator.
source§

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

Performs the * operation. Read more
source§

impl MulAssign<f64> for Point2

source§

fn mul_assign(&mut self, rhs: f64)

Performs the *= operation. Read more
source§

impl Neg for Point2

§

type Output = Point2

The resulting type after applying the - operator.
source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
source§

impl PartialEq for Point2

source§

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

§

type Output = Point2

The resulting type after applying the - operator.
source§

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

Performs the - operation. Read more
source§

impl Sub for Point2

§

type Output = Vec2

The resulting type after applying the - operator.
source§

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

Performs the - operation. Read more
source§

impl SubAssign<Vec2> for Point2

source§

fn sub_assign(&mut self, rhs: Vec2)

Performs the -= operation. Read more
source§

impl TryFrom<&[f64]> for Point2

§

type Error = &'static str

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

fn try_from(s: &[f64]) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Vec<f64>> for Point2

§

type Error = &'static str

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

fn try_from(v: Vec<f64>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl Copy for Point2

source§

impl StructuralPartialEq for Point2

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.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
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.