Struct cgmath::Plane [] [src]

pub struct Plane<S> {
    pub n: Vector3<S>,
    pub d: S,
}

A 3-dimensional plane formed from the equation: A*x + B*y + C*z - D = 0.

Fields

Notes

The A*x + B*y + C*z - D = 0 form is preferred over the other common alternative, A*x + B*y + C*z + D = 0, because it tends to avoid superfluous negations (see Real Time Collision Detection, p. 55).

Fields

n
d

Methods

impl<S: BaseFloat> Plane<S>

fn new(n: Vector3<S>, d: S) -> Plane<S>

Construct a plane from a normal vector and a scalar distance. The plane will be perpendicular to n, and d units offset from the origin.

fn from_abcd(a: S, b: S, c: S, d: S) -> Plane<S>

Arguments

  • a: the x component of the normal
  • b: the y component of the normal
  • c: the z component of the normal
  • d: the plane's distance value

fn from_vector4(v: Vector4<S>) -> Plane<S>

Construct a plane from the components of a four-dimensional vector

fn from_vector4_alt(v: Vector4<S>) -> Plane<S>

Construct a plane from the components of a four-dimensional vector Assuming alternative representation: A*x + B*y + C*z + D = 0

fn from_points(a: Point3<S>, b: Point3<S>, c: Point3<S>) -> Option<Plane<S>>

Constructs a plane that passes through the the three points a, b and c

fn from_point_normal(p: Point3<S>, n: Vector3<S>) -> Plane<S>

Construct a plane from a point and a normal vector. The plane will contain the point p and be perpendicular to n.

fn normalize(&self) -> Option<Plane<S>>

Normalize a plane.

Trait Implementations

impl<S: BaseFloat + ApproxEq<S>> ApproxEq<S> for Plane<S>

fn approx_eq_eps(&self, other: &Plane<S>, epsilon: &S) -> bool

fn approx_epsilon(_hack: Option<Self>) -> T

fn approx_eq(&self, other: &Self) -> bool

impl<S: BaseFloat> Debug for Plane<S>

fn fmt(&self, f: &mut Formatter) -> Result

Derived Implementations

impl<S: Decodable> Decodable for Plane<S>

fn decode<__D: Decoder>(__arg_0: &mut __D) -> Result<Plane<S>, __D::Error>

impl<S: Encodable> Encodable for Plane<S>

fn encode<__S: Encoder>(&self, __arg_0: &mut __S) -> Result<(), __S::Error>

impl<S: PartialEq> PartialEq for Plane<S>

fn eq(&self, __arg_0: &Plane<S>) -> bool

fn ne(&self, __arg_0: &Plane<S>) -> bool

impl<S: Clone> Clone for Plane<S>

fn clone(&self) -> Plane<S>

fn clone_from(&mut self, source: &Self)

impl<S: Copy> Copy for Plane<S>