Expand description
Mathematical point on the 2D (x, y) plane.
Fields§
§x: f32
Horizontal component
y: f32
Vertical component
Implementations§
source§impl Point2f
impl Point2f
sourcepub fn to_i32(self) -> Point2i
pub fn to_i32(self) -> Point2i
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.
sourcepub fn to_u32(self) -> Point2u
pub fn to_u32(self) -> Point2u
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.
sourcepub fn rounded(self) -> Point2f
pub fn rounded(self) -> Point2f
Rounds the values in the point to the nearest integer, rounding away from zero in the half-way case.
See f32::round
sourcepub fn is_approx_eq(self, other: impl Into<Point2f>, epsilon: f32) -> bool
pub fn is_approx_eq(self, other: impl Into<Point2f>, epsilon: f32) -> bool
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.