[][src]Struct beehive::QuadPrism

pub struct QuadPrism<T> {
    pub low: PointAxial<T>,
    pub high: PointAxial<T>,
}

A parallelogram prism aligned to X and Y axes.

T should generally be a signed integer type. Floating point numbers have precision problems that may lead to invalid coordinates after operations.

Fields

low: PointAxial<T>high: PointAxial<T>

Methods

impl<T: PartialOrd + One + Add<Output = T>> QuadPrism<T>[src]

pub fn new(low: PointAxial<T>, high: PointAxial<T>) -> Self[src]

Creates directly from low and high coordinate points, excluding high. If any component of high is lower than low, the resulting prism will contain no points.

pub fn from_points_axial(a: PointAxial<T>, b: PointAxial<T>) -> Self[src]

Creates a quad prism that contains both a and b, inclusive.

pub fn from_points(a: Point<T>, b: Point<T>) -> Self[src]

Creates a quad prism that contains both a and b, inclusive.

pub fn from_base_size_axial(base: PointAxial<T>, size: VectorAxial<T>) -> Self where
    T: Copy + Zero + One + AddAssign + SubAssign + Neg<Output = T>, 
[src]

Creates a quad prism from a base point and a size vector. Negative size allowed.

pub fn from_base_size(base: Point<T>, size: Vector<T>) -> Self where
    T: Copy + Zero + One + AddAssign + SubAssign + Neg<Output = T>, 
[src]

Creates a quad prism from a base point and a size vector. Negative size allowed.

pub fn from_center_size_axial(
    center: PointAxial<T>,
    size: VectorAxial<T>
) -> Self where
    T: Copy + Zero + One + AddAssign + SubAssign + Neg<Output = T> + Div<Output = T>, 
[src]

Creates a quad prism from a center point and a size vector. Negative size allowed.

pub fn from_center_size(center: Point<T>, size: Vector<T>) -> Self where
    T: Copy + Zero + One + AddAssign + SubAssign + Neg<Output = T> + Div<Output = T>, 
[src]

Creates a quad prism from a center point and a size vector. Negative size allowed.

pub fn expand_into_point_axial(&mut self, point: PointAxial<T>)[src]

Expand to include the point.

pub fn expand_into_point(&mut self, point: Point<T>)[src]

Expand to include the point.

pub fn column(self, x: T) -> Option<Self> where
    T: Copy
[src]

Limit the prism's span on X-axis to 1. Returns None if x is out of bounds.

pub fn row(self, y: T) -> Option<Self> where
    T: Copy
[src]

Limit the prism's span on Y-axis to 1. Returns None if y is out of bounds.

pub fn layer(self, w: T) -> Option<Self> where
    T: Copy
[src]

Limit the prism's span on W-axis to 1. Returns None if w is out of bounds.

impl<T: Copy + PartialOrd + Mul<Output = T> + Zero + Sub<Output = T>> QuadPrism<T>[src]

pub fn size_axial(&self) -> VectorAxial<T>[src]

Returns the size vector of the prism, clamped to non-negative X, Y, and W components.

pub fn size(&self) -> Vector<T>[src]

Returns the size vector of the prism, clamped to non-negative X, Y, and W components.

Z will be non-positive as per the plane constraint.

pub fn volume(&self) -> i64 where
    T: AsPrimitive<i64>, 
[src]

Returns the volume of the prism.

pub fn center_axial(&self) -> PointAxial<T> where
    T: One + Div<Output = T>, 
[src]

Returns the center point of the prism.

pub fn center(&self) -> Point<T> where
    T: One + Div<Output = T>, 
[src]

Returns the center point of the prism.

impl<T: PartialOrd> QuadPrism<T>[src]

pub fn is_empty(&self) -> bool[src]

Returns true if the prism contains no points.

pub fn contains_axial(&self, pt: &PointAxial<T>) -> bool[src]

Returns true if the point is contained in the prism.

pub fn contains(&self, pt: &Point<T>) -> bool[src]

Returns true if the point is contained in the prism.

pub fn intersection(self, other: QuadPrism<T>) -> QuadPrism<T>[src]

Returns the intersection between two prisms. The result may be empty.

It's possible to check for intersection by calling is_empty on the result. See also intersects.

pub fn intersects(&self, other: &QuadPrism<T>) -> bool[src]

Returns true if the prisms intersect, without consuming them.

Performance should be the same as using intersection and is_empty. The difference is in semantics and convenience.

pub fn covers(&self, other: &QuadPrism<T>) -> bool where
    T: PartialEq
[src]

Returns true if this prism completely covers other, without consuming them.

Performance should be the same as using intersection and eq. The difference is in semantics and convenience.

pub fn union(self, other: QuadPrism<T>) -> QuadPrism<T>[src]

Returns a prism that covers both prisms. The result may be non-empty if both prisms are empty, but placed at different positions.

It is guaranteed that:

  • The results are equal whichever way the function is called.
  • covers on the result returns true for both input prisms.

pub fn union_short_circuit(self, other: QuadPrism<T>) -> QuadPrism<T>[src]

Returns a prism that covers all points covered by either prism. Differs from union that covers isn't guaranteed to return true.

It is guaranteed that:

  • Unions between empty prisms, wherever they're placed, are empty.
  • Unions between an empty prism and a non-empty one, is equal to the non-empty one.
  • When both prisms are non-empty, the results are equal whichever way the function is called.

pub fn clamp(self, v: Point<T>) -> Option<Point<T>> where
    T: Copy + Sub<Output = T> + One + Zero
[src]

Clamps a point to the bounds of this prism. Returns None if the prism is empty.

pub fn clamp_axial(self, v: PointAxial<T>) -> Option<PointAxial<T>> where
    T: Sub<Output = T> + One
[src]

Clamps a point to the bounds of this prism.

pub fn points_axial(&self) -> PointsAxial<T> where
    T: Copy + PartialOrd + AddAssign + One
[src]

Returns an iterator through all points in a prism from -X to +X, -Y to +Y, bottom-up, in that order.

pub fn points(&self) -> Points<T> where
    T: Copy + PartialOrd + AddAssign + One
[src]

Returns an iterator through all points in a prism from -X to +X, -Y to +Y, bottom-up, in that order.

Trait Implementations

impl<T: Clone> Clone for QuadPrism<T>[src]

impl<T: Copy> Copy for QuadPrism<T>[src]

impl<T: Debug> Debug for QuadPrism<T>[src]

impl<T: Default> Default for QuadPrism<T>[src]

impl<'de, T> Deserialize<'de> for QuadPrism<T> where
    T: Deserialize<'de>, 
[src]

impl<T: Eq> Eq for QuadPrism<T>[src]

impl<T> Extend<Point<T>> for QuadPrism<T> where
    T: PartialOrd + One + Add<Output = T>, 
[src]

impl<T> Extend<PointAxial<T>> for QuadPrism<T> where
    T: PartialOrd + One + Add<Output = T>, 
[src]

impl<V> From<QuadPrism<V>> for Geom<V>[src]

impl<T> FromIterator<Point<T>> for QuadPrism<T> where
    T: Copy + Default + PartialOrd + One + Add<Output = T>, 
[src]

impl<T> FromIterator<PointAxial<T>> for QuadPrism<T> where
    T: Copy + Default + PartialOrd + One + Add<Output = T>, 
[src]

impl<T: Hash> Hash for QuadPrism<T>[src]

impl<T: PartialEq> PartialEq<QuadPrism<T>> for QuadPrism<T>[src]

impl<T> Serialize for QuadPrism<T> where
    T: Serialize
[src]

impl<T> StructuralEq for QuadPrism<T>[src]

impl<T> StructuralPartialEq for QuadPrism<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for QuadPrism<T> where
    T: RefUnwindSafe

impl<T> Send for QuadPrism<T> where
    T: Send

impl<T> Sync for QuadPrism<T> where
    T: Sync

impl<T> Unpin for QuadPrism<T> where
    T: Unpin

impl<T> UnwindSafe for QuadPrism<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.