pub struct Obb3<S> {
pub center: Point3<S>,
pub extents: Vec3<Positive<S>>,
pub orientation: Angles3<S>,
}Available on crate feature
math-utils only.Expand description
3D oriented bounding box
Fields§
§center: Point3<S>§extents: Vec3<Positive<S>>§orientation: Angles3<S>Implementations§
Source§impl<S> Obb3<S>where
S: OrderedRing,
impl<S> Obb3<S>where
S: OrderedRing,
Sourcepub const fn new(
center: Point3<S>,
extents: Vec3<Positive<S>>,
orientation: Angles3<S>,
) -> Obb3<S>
pub const fn new( center: Point3<S>, extents: Vec3<Positive<S>>, orientation: Angles3<S>, ) -> Obb3<S>
Construct a new OBB
Sourcepub fn containing_points_with_orientation(
points: &[Point3<S>],
orientation: Angles3<S>,
) -> Option<Obb3<S>>
pub fn containing_points_with_orientation( points: &[Point3<S>], orientation: Angles3<S>, ) -> Option<Obb3<S>>
Compute the OBB of a given orientation.
Returns None if the points span an empty set.
Sourcepub fn containing_points_approx(points: &[Point3<S>]) -> Option<Obb3<S>>
pub fn containing_points_approx(points: &[Point3<S>]) -> Option<Obb3<S>>
Construct an approximate minimum OBB containing the convex hull of a given set of points.
Returns None if fewer than 4 points are given or if points span an empty set:
assert!(Obb3::containing_points_approx (
&[[0.0, 1.0, 0.0], [1.0, 0.0, 0.0], [0.0, 0.0, 1.0]].map (Point3::from)
).is_none());
assert!(Obb3::containing_points_approx (
&[[1.0, 0.0, 1.0], [0.0, 1.0, 0.0], [0.0, -1.0, 0.0], [-1.0, 0.0, -1.0]]
.map (Point3::from)
).is_none());Sourcepub fn containing_approx(
hull: &Hull3<S>,
mesh: &VertexEdgeTriangleMesh,
) -> Option<Obb3<S>>
pub fn containing_approx( hull: &Hull3<S>, mesh: &VertexEdgeTriangleMesh, ) -> Option<Obb3<S>>
Construct an approximate minimum OBB containing the given convex hull and corresponding mesh.
Returns None if fewer than 4 points are given or if points span an empty set:
let (hull, mesh) = Hull3::from_points_with_mesh (
&[[0.0, 1.0, 0.0], [1.0, 0.0, 0.0], [0.0, 0.0, 1.0]].map (Point3::from)
).unwrap();
assert!(Obb3::containing_approx (&hull, &mesh).is_none());
let (hull, mesh) = Hull3::from_points_with_mesh (
&[[1.0, 0.0, 1.0], [0.0, 1.0, 0.0], [0.0, -1.0, 0.0], [-1.0, 0.0, -1.0]]
.map (Point3::from)
).unwrap();
assert!(Obb3::containing_approx (&hull, &mesh).is_none());Sourcepub fn containing_approx_pca(hull: &Hull3<S>) -> Option<Obb3<S>>
pub fn containing_approx_pca(hull: &Hull3<S>) -> Option<Obb3<S>>
Construct an approximate minimum OBB containing the given convex hull of points oriented according to principal component analysis bases.
Returns None if fewer than 4 points are given or if points span an empty set:
let hull = Hull3::from_points (
&[[0.0, 1.0, 0.0], [1.0, 0.0, 0.0], [0.0, 0.0, 1.0]].map (Point3::from)
).unwrap();
assert!(Obb3::containing_approx_pca (&hull).is_none());
let hull = Hull3::from_points (
&[[1.0, 0.0, 1.0], [0.0, 1.0, 0.0], [0.0, -1.0, 0.0], [-1.0, 0.0, -1.0]]
.map (Point3::from)
).unwrap();
assert!(Obb3::containing_approx_pca (&hull).is_none());pub fn dimensions(self) -> Vec3<Positive<S>>
pub fn volume(self) -> Positive<S>
pub fn corners(self) -> [Point3<S>; 8]
pub fn aabb(self) -> Aabb3<S>
Trait Implementations§
impl<S> Copy for Obb3<S>where
S: Copy,
impl<S> Eq for Obb3<S>where
S: Eq,
impl<S> StructuralPartialEq for Obb3<S>
Auto Trait Implementations§
impl<S> Freeze for Obb3<S>where
S: Freeze,
impl<S> RefUnwindSafe for Obb3<S>where
S: RefUnwindSafe,
impl<S> Send for Obb3<S>where
S: Send,
impl<S> Sync for Obb3<S>where
S: Sync,
impl<S> Unpin for Obb3<S>where
S: Unpin,
impl<S> UnsafeUnpin for Obb3<S>where
S: UnsafeUnpin,
impl<S> UnwindSafe for Obb3<S>where
S: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Content for Twhere
T: Copy,
impl<T> Content for Twhere
T: Copy,
Source§unsafe fn read<F, E>(size: usize, f: F) -> Result<T, E>
unsafe fn read<F, E>(size: usize, f: F) -> Result<T, E>
Prepares an output buffer, then turns this buffer into an
Owned.
User-provided closure F must only write to and not read from &mut Self.Source§fn get_elements_size() -> usize
fn get_elements_size() -> usize
Returns the size of each element.
Source§fn to_void_ptr(&self) -> *const ()
fn to_void_ptr(&self) -> *const ()
Produces a pointer to the data.
Source§fn ref_from_ptr<'a>(ptr: *mut (), size: usize) -> Option<*mut T>
fn ref_from_ptr<'a>(ptr: *mut (), size: usize) -> Option<*mut T>
Builds a pointer to this type from a raw pointer.
Source§fn is_size_suitable(size: usize) -> bool
fn is_size_suitable(size: usize) -> bool
Returns true if the size is suitable to store a type like this.
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere
Dst: LosslessTryFrom<Src>,
impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere
Dst: LosslessTryFrom<Src>,
Source§fn lossless_try_into(self) -> Option<Dst>
fn lossless_try_into(self) -> Option<Dst>
Performs the conversion.
Source§impl<Src, Dst> LossyInto<Dst> for Srcwhere
Dst: LossyFrom<Src>,
impl<Src, Dst> LossyInto<Dst> for Srcwhere
Dst: LossyFrom<Src>,
Source§fn lossy_into(self) -> Dst
fn lossy_into(self) -> Dst
Performs the conversion.
Source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
Source§fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
Source§fn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
Source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Source§impl<T> WrappingAs for T
impl<T> WrappingAs for T
Source§fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
Source§fn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.