pub struct Point2d<T: Copy>(/* private fields */);Expand description
2-dimensional point.
For full functionality for floats, try the ordered_float crate
Implementations§
Source§impl<T> Point2d<T>
impl<T> Point2d<T>
Sourcepub fn get_angle(&self, other: &Self) -> Result<f64>
pub fn get_angle(&self, other: &Self) -> Result<f64>
Returns the angle (from straight up, going clockwise) between self and other in
radians. Can return an error if both points are the same.
use aoclib_rs::point::Point2d;
assert_eq!(
Point2d::new(0, 0).get_angle(&Point2d::new(1, 0)).unwrap(),
std::f64::consts::FRAC_PI_2
);Trait Implementations§
Source§impl<T: Copy> PointFromArray<T, 2> for Point2d<T>
impl<T: Copy> PointFromArray<T, 2> for Point2d<T>
Source§fn from_array(vals: [T; 2]) -> Self
fn from_array(vals: [T; 2]) -> Self
Initializes a point from an array.
Source§impl<T> PointManhattan<T> for Point2d<T>
impl<T> PointManhattan<T> for Point2d<T>
impl<T: Eq + Copy> Eq for Point2d<T>
impl<T: Copy> StructuralPartialEq for Point2d<T>
Auto Trait Implementations§
impl<T> Freeze for Point2d<T>where
T: Freeze,
impl<T> RefUnwindSafe for Point2d<T>where
T: RefUnwindSafe,
impl<T> Send for Point2d<T>where
T: Send,
impl<T> Sync for Point2d<T>where
T: Sync,
impl<T> Unpin for Point2d<T>where
T: Unpin,
impl<T> UnwindSafe for Point2d<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