pub struct Point2<S> {
pub x: S,
pub y: S,
}
Expand description
A point in 2-dimensional space.
Fields§
§x: S
§y: S
Implementations§
Trait Implementations§
source§impl<S: BaseNum> Array for Point2<S>
impl<S: BaseNum> Array for Point2<S>
source§impl<S: PartialEq> PartialEq<Point2<S>> for Point2<S>
impl<S: PartialEq> PartialEq<Point2<S>> for Point2<S>
source§impl<S: BaseNum> Point for Point2<S>
impl<S: BaseNum> Point for Point2<S>
source§fn mul_s(self, scalar: S) -> Point2<S>
fn mul_s(self, scalar: S) -> Point2<S>
Multiply each component by a scalar, returning the new point.
source§fn div_s(self, scalar: S) -> Point2<S>
fn div_s(self, scalar: S) -> Point2<S>
Divide each component by a scalar, returning the new point.
source§fn rem_s(self, scalar: S) -> Point2<S>
fn rem_s(self, scalar: S) -> Point2<S>
Subtract a scalar from each component, returning the new point.
source§fn add_v(self, v: Vector2<S>) -> Point2<S>
fn add_v(self, v: Vector2<S>) -> Point2<S>
Add a vector to this point, returning the new point.
source§fn sub_p(self, p: Point2<S>) -> Vector2<S>
fn sub_p(self, p: Point2<S>) -> Vector2<S>
Subtract another point from this one, returning a new vector.
source§fn mul_self_s(&mut self, scalar: S)
fn mul_self_s(&mut self, scalar: S)
Multiply each component by a scalar, in-place.
source§fn div_self_s(&mut self, scalar: S)
fn div_self_s(&mut self, scalar: S)
Divide each component by a scalar, in-place.
source§fn rem_self_s(&mut self, scalar: S)
fn rem_self_s(&mut self, scalar: S)
Take the remainder of each component by a scalar, in-place.
source§fn add_self_v(&mut self, v: Vector2<S>)
fn add_self_v(&mut self, v: Vector2<S>)
Add a vector to this point, in-place.
fn min(self, p: Point2<S>) -> Point2<S>
fn max(self, p: Point2<S>) -> Point2<S>
source§impl<S: BaseFloat> Rotation<Point2<S>> for Basis2<S>
impl<S: BaseFloat> Rotation<Point2<S>> for Basis2<S>
source§fn look_at(dir: Vector2<S>, up: Vector2<S>) -> Basis2<S>
fn look_at(dir: Vector2<S>, up: Vector2<S>) -> Basis2<S>
Create a rotation to a given direction with an ‘up’ vector
source§fn between_vectors(a: Vector2<S>, b: Vector2<S>) -> Basis2<S>
fn between_vectors(a: Vector2<S>, b: Vector2<S>) -> Basis2<S>
Create a shortest rotation to transform vector ‘a’ into ‘b’.
Both given vectors are assumed to have unit length.
source§fn rotate_vector(&self, vec: Vector2<S>) -> Vector2<S>
fn rotate_vector(&self, vec: Vector2<S>) -> Vector2<S>
Rotate a vector using this rotation.
source§fn concat(&self, other: &Basis2<S>) -> Basis2<S>
fn concat(&self, other: &Basis2<S>) -> Basis2<S>
Create a new rotation which combines both this rotation, and another.
source§fn concat_self(&mut self, other: &Basis2<S>)
fn concat_self(&mut self, other: &Basis2<S>)
Modify this rotation in-place by combining it with another.
source§fn invert(&self) -> Basis2<S>
fn invert(&self) -> Basis2<S>
Create a new rotation which “un-does” this rotation. That is,
r.concat(r.invert())
is the identity.source§fn invert_self(&mut self)
fn invert_self(&mut self)
Invert this rotation in-place.
source§fn rotate_point(&self, point: P) -> P
fn rotate_point(&self, point: P) -> P
Rotate a point using this rotation, by converting it to its
representation as a vector.
impl<S: Copy> Copy for Point2<S>
impl<S: Eq> Eq for Point2<S>
impl<S> StructuralEq for Point2<S>
impl<S> StructuralPartialEq for Point2<S>
Auto Trait Implementations§
impl<S> RefUnwindSafe for Point2<S>where S: RefUnwindSafe,
impl<S> Send for Point2<S>where S: Send,
impl<S> Sync for Point2<S>where S: Sync,
impl<S> Unpin for Point2<S>where S: Unpin,
impl<S> UnwindSafe for Point2<S>where S: 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