pub struct Point2 {
pub x: f64,
pub y: f64,
}Expand description
2D point.
Fields§
§x: f64§y: f64Implementations§
Source§impl Point2
impl Point2
pub fn new(x: f64, y: f64) -> Self
Sourcepub fn distance_to(self, other: Point2) -> f64
pub fn distance_to(self, other: Point2) -> f64
Euclidean distance to another point.
Sourcepub fn rotate(self, angle: f64) -> Point2
pub fn rotate(self, angle: f64) -> Point2
Rotate by angle radians counterclockwise about the origin.
Sourcepub fn rotate_around(self, angle: f64, center: Point2) -> Point2
pub fn rotate_around(self, angle: f64, center: Point2) -> Point2
Rotate by angle radians about center.
Trait Implementations§
impl Copy for Point2
impl StructuralPartialEq for Point2
Auto Trait Implementations§
impl Freeze for Point2
impl RefUnwindSafe for Point2
impl Send for Point2
impl Sync for Point2
impl Unpin for Point2
impl UnsafeUnpin for Point2
impl UnwindSafe for Point2
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