[−][src]Struct beehive::QuadPrism
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]
T: Copy + Zero + One + AddAssign + SubAssign + Neg<Output = T>,
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]
T: Copy + Zero + One + AddAssign + SubAssign + Neg<Output = T>,
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]
center: PointAxial<T>,
size: VectorAxial<T>
) -> Self where
T: Copy + Zero + One + AddAssign + SubAssign + Neg<Output = T> + Div<Output = T>,
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]
T: Copy + Zero + One + AddAssign + SubAssign + Neg<Output = T> + Div<Output = T>,
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]
T: Copy,
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]
T: Copy,
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]
T: Copy,
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]
T: AsPrimitive<i64>,
Returns the volume of the prism.
pub fn center_axial(&self) -> PointAxial<T> where
T: One + Div<Output = T>,
[src]
T: One + Div<Output = T>,
Returns the center point of the prism.
pub fn center(&self) -> Point<T> where
T: One + Div<Output = T>,
[src]
T: One + Div<Output = T>,
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]
T: PartialEq,
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 returnstrue
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]
T: Copy + Sub<Output = T> + One + Zero,
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]
T: Sub<Output = T> + One,
Clamps a point to the bounds of this prism.
pub fn points_axial(&self) -> PointsAxial<T> where
T: Copy + PartialOrd + AddAssign + One,
[src]
T: Copy + PartialOrd + AddAssign + One,
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]
T: Copy + PartialOrd + AddAssign + One,
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]
T: Deserialize<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl<T: Eq> Eq for QuadPrism<T>
[src]
impl<T> Extend<Point<T>> for QuadPrism<T> where
T: PartialOrd + One + Add<Output = T>,
[src]
T: PartialOrd + One + Add<Output = T>,
fn extend<I: IntoIterator<Item = Point<T>>>(&mut self, it: I)
[src]
impl<T> Extend<PointAxial<T>> for QuadPrism<T> where
T: PartialOrd + One + Add<Output = T>,
[src]
T: PartialOrd + One + Add<Output = T>,
fn extend<I: IntoIterator<Item = PointAxial<T>>>(&mut self, it: I)
[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]
T: Copy + Default + PartialOrd + One + Add<Output = T>,
fn from_iter<I: IntoIterator<Item = Point<T>>>(it: I) -> Self
[src]
impl<T> FromIterator<PointAxial<T>> for QuadPrism<T> where
T: Copy + Default + PartialOrd + One + Add<Output = T>,
[src]
T: Copy + Default + PartialOrd + One + Add<Output = T>,
fn from_iter<I: IntoIterator<Item = PointAxial<T>>>(it: I) -> Self
[src]
impl<T: Hash> Hash for QuadPrism<T>
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<T: PartialEq> PartialEq<QuadPrism<T>> for QuadPrism<T>
[src]
impl<T> Serialize for QuadPrism<T> where
T: Serialize,
[src]
T: Serialize,
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
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,
T: RefUnwindSafe,
impl<T> Send for QuadPrism<T> where
T: Send,
T: Send,
impl<T> Sync for QuadPrism<T> where
T: Sync,
T: Sync,
impl<T> Unpin for QuadPrism<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for QuadPrism<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,