pub struct Hyperellipsoid<const N: usize> { /* private fields */ }Expand description
The geometry resulting from an Hypersphere that is scaled along the Cartesian axes.
See Ellipse and Ellipsoid for special cases in 2 and 3 dimensions.
§Examples
Basic construction and methods:
use approxim::assert_relative_eq;
use hoomd_geometry::{BoundingSphereRadius, Volume, shape::Hyperellipsoid};
use std::f64::consts::PI;
let ellipse =
Hyperellipsoid::with_semi_axes([1.0.try_into()?, 2.0.try_into()?]);
let bounding_radius = ellipse.bounding_sphere_radius();
let volume = ellipse.volume();
assert_eq!(bounding_radius.get(), 2.0);
assert_relative_eq!(volume, PI * 1.0 * 2.0);
let sphere = Hyperellipsoid::with_semi_axes([
2.0.try_into()?,
2.0.try_into()?,
2.0.try_into()?,
]);
let bounding_radius = sphere.bounding_sphere_radius();
let volume = sphere.volume();
assert_eq!(bounding_radius.get(), 2.0);
assert_eq!(volume, 4.0 / 3.0 * PI * 2.0_f64.powi(3));Implementations§
Source§impl<const N: usize> Hyperellipsoid<N>
impl<const N: usize> Hyperellipsoid<N>
Sourcepub fn with_semi_axes(semi_axes: [PositiveReal; N]) -> Self
pub fn with_semi_axes(semi_axes: [PositiveReal; N]) -> Self
Construct a new Hyperellipsoid with the given semi-axes along each Cartesian direction.
Sourcepub fn semi_axes(&self) -> &[PositiveReal; N]
pub fn semi_axes(&self) -> &[PositiveReal; N]
Get the semi axes.
Trait Implementations§
Source§impl<const N: usize> BoundingSphereRadius for Hyperellipsoid<N>
impl<const N: usize> BoundingSphereRadius for Hyperellipsoid<N>
Source§fn bounding_sphere_radius(&self) -> PositiveReal
fn bounding_sphere_radius(&self) -> PositiveReal
Get the bounding radius.
Source§impl<const N: usize> Clone for Hyperellipsoid<N>
impl<const N: usize> Clone for Hyperellipsoid<N>
Source§fn clone(&self) -> Hyperellipsoid<N>
fn clone(&self) -> Hyperellipsoid<N>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<const N: usize> Debug for Hyperellipsoid<N>
impl<const N: usize> Debug for Hyperellipsoid<N>
Source§impl<'de, const N: usize> Deserialize<'de> for Hyperellipsoid<N>
impl<'de, const N: usize> Deserialize<'de> for Hyperellipsoid<N>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<R> IntersectsAt<Hyperellipsoid<2>, Cartesian<2>, R> for Hyperellipsoid<2>
impl<R> IntersectsAt<Hyperellipsoid<2>, Cartesian<2>, R> for Hyperellipsoid<2>
Source§fn intersects_at(
&self,
other: &Hyperellipsoid<2>,
v_ij: &Cartesian<2>,
o_ij: &R,
) -> bool
fn intersects_at( &self, other: &Hyperellipsoid<2>, v_ij: &Cartesian<2>, o_ij: &R, ) -> bool
Test whether the set of points in one shape intersects with the set of another
(in the local frame). Read more
Source§fn approximate_separation_distance(
&self,
other: &S,
v_ij: &V,
o_ij: &R,
resolution: PositiveReal,
) -> f64where
V: InnerProduct,
fn approximate_separation_distance(
&self,
other: &S,
v_ij: &V,
o_ij: &R,
resolution: PositiveReal,
) -> f64where
V: InnerProduct,
Approximate the amount of overlap between two shapes. Read more
Source§impl<R> IntersectsAtGlobal<Hyperellipsoid<2>, Cartesian<2>, R> for Hyperellipsoid<2>
impl<R> IntersectsAtGlobal<Hyperellipsoid<2>, Cartesian<2>, R> for Hyperellipsoid<2>
Source§fn intersects_at_global(
&self,
other: &Hyperellipsoid<2>,
r_self: &Cartesian<2>,
o_self: &R,
r_other: &Cartesian<2>,
o_other: &R,
) -> bool
fn intersects_at_global( &self, other: &Hyperellipsoid<2>, r_self: &Cartesian<2>, o_self: &R, r_other: &Cartesian<2>, o_other: &R, ) -> bool
Test whether the set of points in one shape intersects with the set of another
(in the global frame). Read more
Source§impl<const N: usize> PartialEq for Hyperellipsoid<N>
impl<const N: usize> PartialEq for Hyperellipsoid<N>
Source§impl<const N: usize> Serialize for Hyperellipsoid<N>
impl<const N: usize> Serialize for Hyperellipsoid<N>
Source§impl<const N: usize> SupportMapping<Cartesian<N>> for Hyperellipsoid<N>
impl<const N: usize> SupportMapping<Cartesian<N>> for Hyperellipsoid<N>
Source§fn support_mapping(&self, n: &Cartesian<N>) -> Cartesian<N>
fn support_mapping(&self, n: &Cartesian<N>) -> Cartesian<N>
Return the furthest extent of a shape in the direction of
n.Source§impl<const N: usize> Volume for Hyperellipsoid<N>
impl<const N: usize> Volume for Hyperellipsoid<N>
impl<const N: usize> StructuralPartialEq for Hyperellipsoid<N>
Auto Trait Implementations§
impl<const N: usize> Freeze for Hyperellipsoid<N>
impl<const N: usize> RefUnwindSafe for Hyperellipsoid<N>
impl<const N: usize> Send for Hyperellipsoid<N>
impl<const N: usize> Sync for Hyperellipsoid<N>
impl<const N: usize> Unpin for Hyperellipsoid<N>
impl<const N: usize> UnsafeUnpin for Hyperellipsoid<N>
impl<const N: usize> UnwindSafe for Hyperellipsoid<N>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 more