Struct visioncortex::Point2
source · pub struct Point2<T> {
pub x: T,
pub y: T,
}
Expand description
Generic point in 2D space
Fields§
§x: T
§y: T
Implementations§
source§impl<T> Point2<T>
impl<T> Point2<T>
sourcepub fn rotate_90deg(&self, origin: Self, clockwise: bool) -> Self
pub fn rotate_90deg(&self, origin: Self, clockwise: bool) -> Self
Assumes a coordinate system with origin at the top-left. The behavior is undefined otherwise.
source§impl Point2<i32>
impl Point2<i32>
pub fn to_point_usize(&self) -> PointUsize
pub fn to_point_f64(&self) -> PointF64
source§impl Point2<f64>
impl Point2<f64>
pub fn to_point_i32(&self) -> PointI32
pub fn to_point_f32(&self) -> PointF32
Trait Implementations§
source§impl<T> AddAssign for Point2<T>where
T: AddAssign,
impl<T> AddAssign for Point2<T>where
T: AddAssign,
source§fn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
Performs the
+=
operation. Read moresource§impl<F> Coordinate for Point2<F>
impl<F> Coordinate for Point2<F>
source§fn from_components(components: &[f64]) -> Self
fn from_components(components: &[f64]) -> Self
Creates a new coordinate from the specified set of components
source§fn from_biggest_components(p1: Self, p2: Self) -> Self
fn from_biggest_components(p1: Self, p2: Self) -> Self
Returns a point made up of the biggest components of the two points
source§fn from_smallest_components(p1: Self, p2: Self) -> Self
fn from_smallest_components(p1: Self, p2: Self) -> Self
Returns a point made up of the smallest components of the two points
source§fn distance_to(&self, target: &Self) -> f64
fn distance_to(&self, target: &Self) -> f64
Computes the distance between this coordinate and another of the same type
source§fn dot(&self, target: &Self) -> f64
fn dot(&self, target: &Self) -> f64
Computes the dot product for this vector along with another vector
source§fn to_unit_vector(&self) -> Self
fn to_unit_vector(&self) -> Self
Treating this as a vector, returns a unit vector in the same direction
source§fn round(self, accuracy: f64) -> Self
fn round(self, accuracy: f64) -> Self
Round this coordinate so that it is accurate to a certain precision
source§impl<F> Coordinate2D for Point2<F>
impl<F> Coordinate2D for Point2<F>
source§impl<T, F> DivAssign<F> for Point2<T>
impl<T, F> DivAssign<F> for Point2<T>
source§fn div_assign(&mut self, rhs: F)
fn div_assign(&mut self, rhs: F)
Performs the
/=
operation. Read moresource§impl<T, F> MulAssign<F> for Point2<T>
impl<T, F> MulAssign<F> for Point2<T>
source§fn mul_assign(&mut self, rhs: F)
fn mul_assign(&mut self, rhs: F)
Performs the
*=
operation. Read moresource§impl<T: PartialEq> PartialEq for Point2<T>
impl<T: PartialEq> PartialEq for Point2<T>
source§impl<T> SubAssign for Point2<T>where
T: SubAssign,
impl<T> SubAssign for Point2<T>where
T: SubAssign,
source§fn sub_assign(&mut self, other: Self)
fn sub_assign(&mut self, other: Self)
Performs the
-=
operation. Read moresource§impl<T> ToSvgString for Point2<T>where
T: Copy + NumberFormat,
impl<T> ToSvgString for Point2<T>where
T: Copy + NumberFormat,
impl<T: Copy> Copy for Point2<T>
impl<T: Eq> Eq for Point2<T>
impl<T> StructuralPartialEq for Point2<T>
Auto Trait Implementations§
impl<T> Freeze for Point2<T>where
T: Freeze,
impl<T> RefUnwindSafe for Point2<T>where
T: RefUnwindSafe,
impl<T> Send for Point2<T>where
T: Send,
impl<T> Sync for Point2<T>where
T: Sync,
impl<T> Unpin for Point2<T>where
T: Unpin,
impl<T> UnwindSafe for Point2<T>where
T: UnwindSafe,
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