pub trait Point: Copy + Clonewhere
Self: Array<Element = Self::Scalar>,{
type Scalar: BaseNum;
type Vector: Vector<Scalar = Self::Scalar>;
Show 15 methods
// Required methods
fn origin() -> Self;
fn from_vec(v: Self::Vector) -> Self;
fn to_vec(self) -> Self::Vector;
fn mul_s(self, scalar: Self::Scalar) -> Self;
fn div_s(self, scalar: Self::Scalar) -> Self;
fn rem_s(self, scalar: Self::Scalar) -> Self;
fn add_v(self, v: Self::Vector) -> Self;
fn sub_p(self, p: Self) -> Self::Vector;
fn mul_self_s(&mut self, scalar: Self::Scalar);
fn div_self_s(&mut self, scalar: Self::Scalar);
fn rem_self_s(&mut self, scalar: Self::Scalar);
fn add_self_v(&mut self, v: Self::Vector);
fn dot(self, v: Self::Vector) -> Self::Scalar;
fn min(self, p: Self) -> Self;
fn max(self, p: Self) -> Self;
}
Expand description
Specifies the numeric operations for point types.
Required Associated Types§
Required Methods§
sourcefn mul_s(self, scalar: Self::Scalar) -> Self
fn mul_s(self, scalar: Self::Scalar) -> Self
Multiply each component by a scalar, returning the new point.
sourcefn div_s(self, scalar: Self::Scalar) -> Self
fn div_s(self, scalar: Self::Scalar) -> Self
Divide each component by a scalar, returning the new point.
sourcefn rem_s(self, scalar: Self::Scalar) -> Self
fn rem_s(self, scalar: Self::Scalar) -> Self
Subtract a scalar from each component, returning the new point.
sourcefn sub_p(self, p: Self) -> Self::Vector
fn sub_p(self, p: Self) -> Self::Vector
Subtract another point from this one, returning a new vector.
sourcefn mul_self_s(&mut self, scalar: Self::Scalar)
fn mul_self_s(&mut self, scalar: Self::Scalar)
Multiply each component by a scalar, in-place.
sourcefn div_self_s(&mut self, scalar: Self::Scalar)
fn div_self_s(&mut self, scalar: Self::Scalar)
Divide each component by a scalar, in-place.
sourcefn rem_self_s(&mut self, scalar: Self::Scalar)
fn rem_self_s(&mut self, scalar: Self::Scalar)
Take the remainder of each component by a scalar, in-place.
sourcefn add_self_v(&mut self, v: Self::Vector)
fn add_self_v(&mut self, v: Self::Vector)
Add a vector to this point, in-place.
sourcefn dot(self, v: Self::Vector) -> Self::Scalar
fn dot(self, v: Self::Vector) -> Self::Scalar
This is a weird one, but its useful for plane calculations.