pub struct Hrbf<T, K>{ /* private fields */ }Expand description
An HRBF potential field.
The field and its first and second derivatives can be queried at any 3D position.
Additionally this field can be reset with a different set of points and normals using one of
the fit, fit_to_points, offset_fit, or offset_fit_to_points methods. Some advanced
functionality is also exposed (see individual methods for details).
Implementations§
Source§impl<T, K> Hrbf<T, K>
impl<T, K> Hrbf<T, K>
Sourcepub fn sites(&self) -> &[Point3<T>] ⓘ
pub fn sites(&self) -> &[Point3<T>] ⓘ
Returns a reference to the vector of site locations used by this HRBF.
Sourcepub fn betas(&self) -> &[Vector4<T>] ⓘ
pub fn betas(&self) -> &[Vector4<T>] ⓘ
(Advanced) Returns a reference to the vector of 4D weight vectors, which determine the global HRBF potential.
These are the unknowns computed during fitting. Each 4D vector has
the structure [aⱼ; bⱼ] per site j where a is a scalar weighing the contribution from
the kernel at site j and b is a 3D vector weighin the contribution from the kernel
gradient at site j to the total HRBF potential.
Sourcepub fn fit(&mut self, normals: &[Vector3<T>]) -> Result<&mut Self>
pub fn fit(&mut self, normals: &[Vector3<T>]) -> Result<&mut Self>
Fit the current HRBF to the sites, with which this HRBF was built.
Normals dictate the direction of the HRBF gradient at the specified sites.
Return a mutable reference to Self if successful.
Sourcepub fn fit_to_points(
&mut self,
points: &[Point3<T>],
normals: &[Vector3<T>],
) -> Result<&mut Self>
pub fn fit_to_points( &mut self, points: &[Point3<T>], normals: &[Vector3<T>], ) -> Result<&mut Self>
Fit the current HRBF to the given data.
Return a mutable reference to Self if successful.
NOTE: Currently, points must be the same size as sites.
Sourcepub fn offset_fit(
&mut self,
offsets: &[T],
normals: &[Vector3<T>],
) -> Result<&mut Self>
pub fn offset_fit( &mut self, offsets: &[T], normals: &[Vector3<T>], ) -> Result<&mut Self>
Fit the current HRBF to the sites, with which this HRBF was built, offset by the given
offsets.
The resulting HRBF field is equal to offsets at the sites.
and has a gradient equal to normals.
Return a mutable reference to Self if successful.
Sourcepub fn offset_fit_to_points(
&mut self,
points: &[Point3<T>],
offsets: &[T],
normals: &[Vector3<T>],
) -> Result<&mut Self>
pub fn offset_fit_to_points( &mut self, points: &[Point3<T>], offsets: &[T], normals: &[Vector3<T>], ) -> Result<&mut Self>
Fit the current HRBF to the given data.
The resulting HRBF field is equal to offsets at the provided points
and has a gradient equal to normals.
Return a mutable reference to Self if successful.
NOTE: Currently, points must be the same size as sites.
Sourcepub fn fit_block(&self, p: Point3<T>, j: usize) -> Matrix4<T>
pub fn fit_block(&self, p: Point3<T>, j: usize) -> Matrix4<T>
(Advanced) Recall that the HRBF fit is done as
∑ⱼ ⎡ 𝜙(𝑥ᵢ - 𝑥ⱼ) ∇𝜙(𝑥ᵢ - 𝑥ⱼ)'⎤ ⎡ 𝛼ⱼ⎤ = ⎡ 0 ⎤
⎣ ∇𝜙(𝑥ᵢ - 𝑥ⱼ) ∇∇𝜙(𝑥ᵢ - 𝑥ⱼ) ⎦ ⎣ 𝛽ⱼ⎦ ⎣ 𝑛ᵢ⎦for every HRBF site i, where the sum runs over HRBF sites j
where 𝜙(𝑥) = 𝜑(||𝑥||) for one of the basis kernels we define in
kernel
If we rewrite the equation above as
∑ⱼ Aⱼ(𝑥ᵢ)bⱼ = rᵢthis function returns the matrix Aⱼ(p).
This is the symmetric 4x4 matrix block that is used to fit the HRBF coefficients.
This is equivalent to stacking the vector from eval_block on top of the
3x4 matrix returned by grad_block. This function is more efficient than
evaluating eval_block and grad_block.
This is [g ∇g]' = [𝜙 (∇𝜙)'; ∇𝜙 ∇(∇𝜙)'] in MATLAB notation.
Sourcepub fn grad_fit_block_prod(
&self,
p: Point3<T>,
b: Vector4<T>,
j: usize,
) -> Matrix3x4<T>
pub fn grad_fit_block_prod( &self, p: Point3<T>, b: Vector4<T>, j: usize, ) -> Matrix3x4<T>
(Advanced) Using the same notation as above,
this function returns the matrix ∇(Aⱼ(p)b)'
Sourcepub fn hess_fit_prod(&self, p: Point3<T>, c: Vector4<T>) -> Matrix3<T>
pub fn hess_fit_prod(&self, p: Point3<T>, c: Vector4<T>) -> Matrix3<T>
Sum of hess_fit_prod_block evaluated at all sites.
Trait Implementations§
Auto Trait Implementations§
impl<T, K> Freeze for Hrbf<T, K>where
K: Freeze,
impl<T, K> RefUnwindSafe for Hrbf<T, K>where
K: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, K> Send for Hrbf<T, K>where
K: Send,
impl<T, K> Sync for Hrbf<T, K>where
K: Sync,
impl<T, K> Unpin for Hrbf<T, K>
impl<T, K> UnsafeUnpin for Hrbf<T, K>where
K: UnsafeUnpin,
impl<T, K> UnwindSafe for Hrbf<T, K>where
K: UnwindSafe,
T: 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.