pub struct RawPoint {
pub components: [f32; 2],
}Expand description
A point (or vector) in 2D map coordinates.
RawPoint supports component-wise arithmetic: Mul, Div,
MulAssign and DivAssign with f32 and the common integer types, and
Add/Sub with other points (by value or by reference). It also
converts from and to [f32; 2], integer arrays and egui::Pos2.
§Examples
use egui_map::map::objects::RawPoint;
let a = RawPoint::new(1.0, 2.0);
let b = RawPoint::new(3.0, -1.0);
assert_eq!((a + b).components, [4.0, 1.0]);
assert_eq!((a * 2.0f32).components, [2.0, 4.0]);Fields§
§components: [f32; 2]The x and y components of the point.
Implementations§
Trait Implementations§
impl Copy for RawPoint
Source§impl DivAssign<f32> for RawPoint
impl DivAssign<f32> for RawPoint
Source§fn div_assign(&mut self, rhs: f32)
fn div_assign(&mut self, rhs: f32)
Performs the
/= operation. Read moreSource§impl DivAssign<i32> for RawPoint
impl DivAssign<i32> for RawPoint
Source§fn div_assign(&mut self, rhs: i32)
fn div_assign(&mut self, rhs: i32)
Performs the
/= operation. Read moreSource§impl DivAssign<i64> for RawPoint
impl DivAssign<i64> for RawPoint
Source§fn div_assign(&mut self, rhs: i64)
fn div_assign(&mut self, rhs: i64)
Performs the
/= operation. Read moreSource§impl DivAssign<u32> for RawPoint
impl DivAssign<u32> for RawPoint
Source§fn div_assign(&mut self, rhs: u32)
fn div_assign(&mut self, rhs: u32)
Performs the
/= operation. Read moreSource§impl DivAssign<u64> for RawPoint
impl DivAssign<u64> for RawPoint
Source§fn div_assign(&mut self, rhs: u64)
fn div_assign(&mut self, rhs: u64)
Performs the
/= operation. Read moreSource§impl MulAssign<f32> for RawPoint
impl MulAssign<f32> for RawPoint
Source§fn mul_assign(&mut self, rhs: f32)
fn mul_assign(&mut self, rhs: f32)
Performs the
*= operation. Read moreSource§impl MulAssign<i32> for RawPoint
impl MulAssign<i32> for RawPoint
Source§fn mul_assign(&mut self, rhs: i32)
fn mul_assign(&mut self, rhs: i32)
Performs the
*= operation. Read moreSource§impl MulAssign<i64> for RawPoint
impl MulAssign<i64> for RawPoint
Source§fn mul_assign(&mut self, rhs: i64)
fn mul_assign(&mut self, rhs: i64)
Performs the
*= operation. Read moreSource§impl MulAssign<u32> for RawPoint
impl MulAssign<u32> for RawPoint
Source§fn mul_assign(&mut self, rhs: u32)
fn mul_assign(&mut self, rhs: u32)
Performs the
*= operation. Read moreSource§impl MulAssign<u64> for RawPoint
impl MulAssign<u64> for RawPoint
Source§fn mul_assign(&mut self, rhs: u64)
fn mul_assign(&mut self, rhs: u64)
Performs the
*= operation. Read moreAuto Trait Implementations§
impl Freeze for RawPoint
impl RefUnwindSafe for RawPoint
impl Send for RawPoint
impl Sync for RawPoint
impl Unpin for RawPoint
impl UnsafeUnpin for RawPoint
impl UnwindSafe for RawPoint
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more