pub struct Point2D {
pub x: f32,
pub y: f32,
}Expand description
Vector used for referencing a point in 2D space.
Fields§
§x: f32X value.
y: f32Y value.
Implementations§
Source§impl Point2D
impl Point2D
Sourcepub fn distance_from_plane(&self, plane: &Plane2D) -> f32
pub fn distance_from_plane(&self, plane: &Plane2D) -> f32
Calculate the distance the point is from the plane.
The value is positive if the point is in front of the plane, zero if intersecting, or negative if behind.
Sourcepub fn distance_from_point_squared(&self, point: &Point2D) -> f32
pub fn distance_from_point_squared(&self, point: &Point2D) -> f32
Calculate the distance the point is from another point. The value is returned squared for performance.
Trait Implementations§
Source§impl TagSerialize for Point2D
impl TagSerialize for Point2D
Source§fn into_tag(
&self,
data: &mut Vec<u8>,
at: usize,
struct_end: usize,
) -> ErrorMessageResult<()>
fn into_tag( &self, data: &mut Vec<u8>, at: usize, struct_end: usize, ) -> ErrorMessageResult<()>
Serialize the data into tag format, returning an error on failure (except for out-of-bounds and allocation errors which will panic).
Source§fn from_tag(
data: &[u8],
at: usize,
struct_end: usize,
_: &mut usize,
) -> ErrorMessageResult<Self>
fn from_tag( data: &[u8], at: usize, struct_end: usize, _: &mut usize, ) -> ErrorMessageResult<Self>
Deserialize the data from tag format, returning an error on failure (except for allocation errors which will panic).
Source§fn into_tag_cached(
&self,
data: &mut [u8],
at: usize,
struct_end: usize,
) -> ErrorMessageResult<()>where
Self: Sized,
fn into_tag_cached(
&self,
data: &mut [u8],
at: usize,
struct_end: usize,
) -> ErrorMessageResult<()>where
Self: Sized,
Serialize the data into tag format in little endian, returning an error on failure (except for out-of-bounds and allocation errors which will panic).
Source§fn from_tag_cached(
data: &[u8],
at: usize,
struct_end: usize,
) -> ErrorMessageResult<Self>where
Self: Sized,
fn from_tag_cached(
data: &[u8],
at: usize,
struct_end: usize,
) -> ErrorMessageResult<Self>where
Self: Sized,
Deserialize the data from tag format from little endian, returning an error on failure (except for allocation errors which will panic).
impl Copy for Point2D
impl StructuralPartialEq for Point2D
Auto Trait Implementations§
impl Freeze for Point2D
impl RefUnwindSafe for Point2D
impl Send for Point2D
impl Sync for Point2D
impl Unpin for Point2D
impl UnwindSafe for Point2D
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more