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 moreSource§impl Point for RawPoint
impl Point for RawPoint
Source§const DIMENSIONS: usize = 2
const DIMENSIONS: usize = 2
The number of dimensions of this point type.
Source§fn generate(generator: impl FnMut(usize) -> Self::Scalar) -> Self
fn generate(generator: impl FnMut(usize) -> Self::Scalar) -> Self
Creates a new point value with given values for each dimension. Read more
impl StructuralPartialEq for RawPoint
Auto 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 moreSource§impl<P> PointDistance for Pwhere
P: Point,
impl<P> PointDistance for Pwhere
P: Point,
Source§fn distance_2(&self, point: &P) -> <P as Point>::Scalar
fn distance_2(&self, point: &P) -> <P as Point>::Scalar
Returns the squared distance between an object and a point. Read more
Source§fn contains_point(
&self,
point: &<<P as RTreeObject>::Envelope as Envelope>::Point,
) -> bool
fn contains_point( &self, point: &<<P as RTreeObject>::Envelope as Envelope>::Point, ) -> bool
Returns
true if a point is contained within this object. Read moreSource§fn distance_2_if_less_or_equal(
&self,
point: &<<P as RTreeObject>::Envelope as Envelope>::Point,
max_distance_2: <<<P as RTreeObject>::Envelope as Envelope>::Point as Point>::Scalar,
) -> Option<<P as Point>::Scalar>
fn distance_2_if_less_or_equal( &self, point: &<<P as RTreeObject>::Envelope as Envelope>::Point, max_distance_2: <<<P as RTreeObject>::Envelope as Envelope>::Point as Point>::Scalar, ) -> Option<<P as Point>::Scalar>
Returns the squared distance to this object, or
None if the distance
is larger than a given maximum value. Read more