Struct orbtk_utils::Point
source · [−]pub struct Point { /* private fields */ }
Expand description
A Point
is specified by a x coordinate and an y coordinate.
Examples
let point = Point::new(10., 10.);
let other_point = Point::new(5., 7.);
let result = point - other_point;
assert_eq!(result.x(), 5.);
assert_eq!(result.y(), 3.);
Implementations
sourceimpl Point
impl Point
sourcepub fn distance(&self, other: Self) -> f64
pub fn distance(&self, other: Self) -> f64
Returns the distance between this Point
and the given Point
.
pub fn min(self, other: impl Into<Point>) -> Point
pub fn max(self, other: impl Into<Point>) -> Point
pub fn sqrt(self) -> Point
pub fn abs(self) -> Point
pub fn clamp(self, min: f64, max: f64) -> Point
Trait Implementations
impl Copy for Point
impl StructuralPartialEq for Point
Auto Trait Implementations
impl RefUnwindSafe for Point
impl Send for Point
impl Sync for Point
impl Unpin for Point
impl UnwindSafe for Point
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more