[−][src]Struct math2d::Point2f
Mathematical point on the 2D (x, y) plane.
Fields
x: f32
Horizontal component
y: f32
Vertical component
Methods
impl Point2f
[src]
pub const ORIGIN: Point2f
[src]
Mathematical origin point on the real number plane.
pub fn new(x: f32, y: f32) -> Self
[src]
Construct a point from the components
pub fn to_i32(self) -> Point2i
[src]
Casts the point to an integer point. Will truncate integers; if another behavior is desired it should be manually performed on the values before calling this function.
pub fn to_u32(self) -> Point2u
[src]
Casts the point to an unsigned integer point. Will truncate integers; if another behavior is desired it should be manually performed on the values before calling this function. Beware this function will not produce reasonable values if the current value is negative.
pub fn to_vector(self) -> Vector2f
[src]
pub fn rounded(self) -> Point2f
[src]
Rounds the values in the point to the nearest integer, rounding away from zero in the half-way case.
See f32::round
pub fn is_approx_eq(self, other: impl Into<Point2f>, epsilon: f32) -> bool
[src]
Determines if the components of two points are less than epsilon
distance from each other. Be wary that this does not check the actual
distance, but a component-wise distance check. If you desire a more
precise distance check, consider subtracting one point from the other
and comparing the length(_sq) of the resulting vector.
Trait Implementations
impl Copy for Point2f
[src]
impl PartialEq<Point2f> for Point2f
[src]
impl Default for Point2f
[src]
impl From<(f32, f32)> for Point2f
[src]
impl From<[f32; 2]> for Point2f
[src]
impl From<Point2f> for [f32; 2]
[src]
impl From<Point2f> for D2D_POINT_2F
[src]
fn from(point: Point2f) -> D2D_POINT_2F
[src]
impl From<D2D_POINT_2F> for Point2f
[src]
fn from(point: D2D_POINT_2F) -> Point2f
[src]
impl From<Point2f> for Point2<f32>
[src]
impl From<Point2<f32>> for Point2f
[src]
impl From<Vec2> for Point2f
[src]
impl Clone for Point2f
[src]
fn clone(&self) -> Point2f
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for Point2f
[src]
impl<V> Add<V> for Point2f where
V: Into<Vector2f>,
[src]
V: Into<Vector2f>,
type Output = Point2f
The resulting type after applying the +
operator.
fn add(self, rhs: V) -> Point2f
[src]
impl Sub<Point2f> for Point2f
[src]
type Output = Vector2f
The resulting type after applying the -
operator.
fn sub(self, rhs: Point2f) -> Vector2f
[src]
impl Sub<(f32, f32)> for Point2f
[src]
type Output = Vector2f
The resulting type after applying the -
operator.
fn sub(self, rhs: (f32, f32)) -> Vector2f
[src]
impl Sub<Point2f> for (f32, f32)
[src]
type Output = Vector2f
The resulting type after applying the -
operator.
fn sub(self, rhs: Point2f) -> Vector2f
[src]
impl<V> Sub<V> for Point2f where
V: Into<Vector2f>,
[src]
V: Into<Vector2f>,
type Output = Point2f
The resulting type after applying the -
operator.
fn sub(self, rhs: V) -> Point2f
[src]
impl Mul<Matrix3x2f> for Point2f
[src]
type Output = Point2f
The resulting type after applying the *
operator.
fn mul(self, m: Matrix3x2f) -> Point2f
[src]
impl Serialize for Point2f
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<'de> Deserialize<'de> for Point2f
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,