[−][src]Struct splashsurf_lib::kernel::DiscreteSquaredDistanceCubicKernel
Accelerator for efficient evaluation of a precomputed cubic kernel
This structure is used to pre-compute a discrete representation of the cubic kernel function.
In some computations that require many evaluations of the kernel, it is more efficient to evaluate
the kernel using a squared distance to avoid taking the square root.
To produce an appropriate quantization of the kernel for this use case, the compact support
radius of the kernel is divided into n
segments with quadratically increasing width.
To be more precise, on a quadratic scale, the compact support [0, h*h]
is divided into n
equally sized
segments of width dr
. For the actual pre-computation, the exact kernel k(r)
is evaluated at the
midpoint m_i
of every segment given by m_i = sqrt(i * dr)
for i ∈ [0, n]
.
This results in an array of kernel values K
that can be evaluated at runtime using a squared radius
s
by just mapping this radius back to the corresponding segment index i
followed by a lookup
in the value array, i.e. k(sqrt(s)) ≈ K[s/dr]
(while taking care of rounding and clamping to the
allowed index range).
Implementations
impl<R: Real> DiscreteSquaredDistanceCubicKernel<R>
[src]
pub fn new(n: usize, h: R) -> Self
[src]
Precomputes the discrete cubic kernel with compact support radius h
, the squared radius h * h
is divided into n
segments for the quantization
pub fn evaluate(&self, r_squared: R) -> R
[src]
Evaluates the precomputed kernel function at the specified squared radius, i.e. returns an approximate cubic kernel value at the radius sqrt(r_squared)
Auto Trait Implementations
impl<R> RefUnwindSafe for DiscreteSquaredDistanceCubicKernel<R> where
R: RefUnwindSafe,
[src]
R: RefUnwindSafe,
impl<R> Send for DiscreteSquaredDistanceCubicKernel<R>
[src]
impl<R> Sync for DiscreteSquaredDistanceCubicKernel<R>
[src]
impl<R> Unpin for DiscreteSquaredDistanceCubicKernel<R> where
R: Unpin,
[src]
R: Unpin,
impl<R> UnwindSafe for DiscreteSquaredDistanceCubicKernel<R> where
R: UnwindSafe,
[src]
R: 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,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
SS: SubsetOf<SP>,
pub fn to_subset(&self) -> Option<SS>
pub fn is_in_subset(&self) -> bool
pub fn to_subset_unchecked(&self) -> SS
pub fn from_subset(element: &SS) -> SP
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.
pub 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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,