Trait cgmath::Point
[−]
[src]
pub trait Point<S: BaseNum, V: Vector<S>>: Array1<S> + Clone {
fn origin() -> Self;
fn from_vec(v: &V) -> Self;
fn to_vec(&self) -> V;
fn mul_s(&self, s: S) -> Self;
fn div_s(&self, s: S) -> Self;
fn rem_s(&self, s: S) -> Self;
fn add_v(&self, v: &V) -> Self;
fn sub_p(&self, p: &Self) -> V;
fn mul_self_s(&mut self, s: S);
fn div_self_s(&mut self, s: S);
fn rem_self_s(&mut self, s: S);
fn add_self_v(&mut self, v: &V);
fn dot(&self, v: &V) -> S;
fn min(&self, p: &Self) -> Self;
fn max(&self, p: &Self) -> Self;
}Specifies the numeric operations for point types.
Required Methods
fn origin() -> Self
Create a point at the origin.
fn from_vec(v: &V) -> Self
Create a point from a vector.
fn to_vec(&self) -> V
Convert a point to a vector.
fn mul_s(&self, s: S) -> Self
Multiply each component by a scalar, returning the new point.
fn div_s(&self, s: S) -> Self
Divide each component by a scalar, returning the new point.
fn rem_s(&self, s: S) -> Self
Subtract a scalar from each component, returning the new point.
fn add_v(&self, v: &V) -> Self
Add a vector to this point, returning the new point.
fn sub_p(&self, p: &Self) -> V
Subtract another point from this one, returning a new vector.
fn mul_self_s(&mut self, s: S)
Multiply each component by a scalar, in-place.
fn div_self_s(&mut self, s: S)
Divide each component by a scalar, in-place.
fn rem_self_s(&mut self, s: S)
Take the remainder of each component by a scalar, in-place.
fn add_self_v(&mut self, v: &V)
Add a vector to this point, in-place.
fn dot(&self, v: &V) -> S
This is a weird one, but its useful for plane calculations.