Struct rten_imageproc::Point
source · pub struct Point<T: Coord = i32> {
pub x: T,
pub y: T,
}
Expand description
A point defined by X and Y coordinates.
Fields§
§x: T
§y: T
Implementations§
source§impl Point<i32>
impl Point<i32>
sourcepub fn coord(self) -> [usize; 2]
pub fn coord(self) -> [usize; 2]
Return self as a [y, x] array. This is useful for indexing into an image or matrix.
Panics if the X or Y coordinates of the point are negative.
sourcepub fn neighbors(self) -> [Point; 8]
pub fn neighbors(self) -> [Point; 8]
Return the neighbors of the current point in clockwise order, starting
from the point directly above self
.
pub fn to_f32(self) -> Point<f32>
pub fn distance(self, other: Point<i32>) -> f32
Trait Implementations§
source§impl<T: PartialEq + Coord> PartialEq for Point<T>
impl<T: PartialEq + Coord> PartialEq for Point<T>
impl<T: Copy + Coord> Copy for Point<T>
impl<T: Eq + Coord> Eq for Point<T>
impl<T: Coord> StructuralPartialEq for Point<T>
Auto Trait Implementations§
impl<T> Freeze for Point<T>where
T: Freeze,
impl<T> RefUnwindSafe for Point<T>where
T: RefUnwindSafe,
impl<T> Send for Point<T>where
T: Send,
impl<T> Sync for Point<T>where
T: Sync,
impl<T> Unpin for Point<T>where
T: Unpin,
impl<T> UnwindSafe for Point<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