Struct plane_split::Plane

source ·
pub struct Plane {
    pub normal: Vector3D<f64>,
    pub offset: f64,
}
Expand description

An infinite plane in 3D space, defined by equation: dot(v, normal) + offset = 0 When used for plane splitting, it’s defining a hemisphere with equation “dot(v, normal) + offset > 0”.

Fields§

§normal: Vector3D<f64>

Normalized vector perpendicular to the plane.

§offset: f64

Constant offset from the normal plane, specified in the direction opposite to the normal.

Implementations§

source§

impl Plane

source

pub fn from_unnormalized( normal: Vector3D<f64>, offset: f64 ) -> Result<Option<Self>, NegativeHemisphereError>

Construct a new plane from unnormalized equation.

source

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

Check if this plane contains another one.

source

pub fn signed_distance_to(&self, point: &Point3D<f64>) -> f64

Return the signed distance from this plane to a point. The distance is negative if the point is on the other side of the plane from the direction of the normal.

source

pub fn distance_to_line(&self, line: &Line) -> f64

Compute the distance across the line to the plane plane, starting from the line origin.

source

pub fn signed_distance_sum_to<A>(&self, poly: &Polygon<A>) -> f64

Compute the sum of signed distances to each of the points of another plane. Useful to know the relation of a plane that is a product of a split, and we know it doesn’t intersect self.

source

pub fn are_outside(&self, points: &[Point3D<f64>]) -> bool

Check if a convex shape defined by a set of points is completely outside of this plane. Merely touching the surface is not considered an intersection.

source

pub fn intersect(&self, other: &Self) -> Option<Line>

Compute the line of intersection with another plane.

Trait Implementations§

source§

impl Clone for Plane

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for Plane

source§

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

Formats the value using the given formatter. Read more
source§

impl PartialEq<Plane> for Plane

source§

fn eq(&self, other: &Plane) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl StructuralPartialEq for Plane

Auto Trait Implementations§

§

impl RefUnwindSafe for Plane

§

impl Send for Plane

§

impl Sync for Plane

§

impl Unpin for Plane

§

impl UnwindSafe for Plane

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.