#[repr(C)]pub struct PointMass<V, S> {
pub position: V,
pub mass: S,
}
Expand description
Point-mass representation of an object in space.
Fields§
§position: V
Position of the object.
mass: S
Mass of the object.
Implementations§
Source§impl<V: Zero, S: Zero> PointMass<V, S>
impl<V: Zero, S: Zero> PointMass<V, S>
Sourcepub const ZERO: Self
pub const ZERO: Self
PointMass
with position and mass set to Zero::ZERO
.
Source§impl<V, S> PointMass<V, S>
impl<V, S> PointMass<V, S>
Sourcepub const fn new(position: V, mass: S) -> Self
pub const fn new(position: V, mass: S) -> Self
Creates a new PointMass
with the given position and mass.
Sourcepub fn new_lane(position: V::Lane, mass: S::Lane) -> Self
pub fn new_lane(position: V::Lane, mass: S::Lane) -> Self
Creates a new PointMass
with the given lanes of positions and masses.
Sourcepub fn new_com(data: &[Self]) -> Self
pub fn new_com(data: &[Self]) -> Self
Returns the PointMass
corresponding to the center of mass and total mass of the given
slice of point-masses.
Sourcepub fn splat_lane(position: V::Element, mass: S::Element) -> Self
pub fn splat_lane(position: V::Element, mass: S::Element) -> Self
Creates a new PointMass
with all lanes set to the given position and mass.
Sourcepub fn slice_to_lane<const L: usize, T, E>(slice: &[PointMass<T, E>]) -> Self
pub fn slice_to_lane<const L: usize, T, E>(slice: &[PointMass<T, E>]) -> Self
Returns a SIMD
point-masses from a slice of SIMD::Element
point-masses.
Sourcepub fn slice_to_lanes<'a, const L: usize, T, E>(
slice: &'a [PointMass<T, E>],
) -> impl Iterator<Item = Self> + 'a
pub fn slice_to_lanes<'a, const L: usize, T, E>( slice: &'a [PointMass<T, E>], ) -> impl Iterator<Item = Self> + 'a
Returns an iterator of SIMD
point-masses from a slice of SIMD::Element
point-masses.
Sourcepub fn is_massless(&self) -> bool
pub fn is_massless(&self) -> bool
Returns true if the mass is zero.
Sourcepub fn is_massive(&self) -> bool
pub fn is_massive(&self) -> bool
Returns false if the mass is zero.
Sourcepub fn force_scalar<const CHECK_ZERO: bool>(
&self,
position: V,
mass: S,
softening: S,
) -> V
pub fn force_scalar<const CHECK_ZERO: bool>( &self, position: V, mass: S, softening: S, ) -> V
Computes the gravitational force exerted on the current point-mass using the given position
and mass. This method is optimised in the case where V
and S
are scalar types.
If the position of the current point-mass is guaranteed to be different from the given
position, this computation can be more efficient with CHECK_ZERO
set to false.
Sourcepub fn force_simd<const CHECK_ZERO: bool>(
&self,
position: V,
mass: S,
softening: S,
) -> V
pub fn force_simd<const CHECK_ZERO: bool>( &self, position: V, mass: S, softening: S, ) -> V
Computes the gravitational force exerted on the current point-mass using the given position
and mass. This method is optimised in the case where V
and S
are simd types.
If the position of the current point-mass is guaranteed to be different from the given
position, this computation can be more efficient with CHECK_ZERO
set to false.
Sourcepub fn acceleration_tree<const X: usize, const D: usize>(
&self,
tree: &Orthtree<X, D, S, PointMass<V, S>>,
node: Option<NodeID>,
theta: S,
softening: S,
) -> V
pub fn acceleration_tree<const X: usize, const D: usize>( &self, tree: &Orthtree<X, D, S, PointMass<V, S>>, node: Option<NodeID>, theta: S, softening: S, ) -> V
Computes the gravitational acceleration exerted on the current point-mass by the specified
node of the given Orthtree
following the Barnes-Hut
approximation with the given theta
parameter, provided V
and S
are scalar types.
Trait Implementations§
impl<V: Copy, S: Copy> Copy for PointMass<V, S>
impl<V: NoUninit, S: NoUninit> NoUninit for PointMass<V, S>
Auto Trait Implementations§
impl<V, S> Freeze for PointMass<V, S>
impl<V, S> RefUnwindSafe for PointMass<V, S>where
V: RefUnwindSafe,
S: RefUnwindSafe,
impl<V, S> Send for PointMass<V, S>
impl<V, S> Sync for PointMass<V, S>
impl<V, S> Unpin for PointMass<V, S>
impl<V, S> UnwindSafe for PointMass<V, S>where
V: UnwindSafe,
S: UnwindSafe,
Blanket Implementations§
Source§impl<U> AsPrimitive for U
impl<U> AsPrimitive for U
Source§fn as_<F: FromPrimitive<Self>>(self) -> F
fn as_<F: FromPrimitive<Self>>(self) -> F
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
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>
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>
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