pub struct RbfDeformer { /* private fields */ }Expand description
A Radial Basis Function (RBF) deformer for 3D point transformations.
This struct implements a deformable model that can smoothly interpolate between a set of control points in 3D space. It’s particularly useful for mesh deformation, shape morphing, and other spatial transformations.
§Fields
x_mean: Mean of the input control points for normalizationx_std: Standard deviation of the input control points for normalizationy_mean: Mean of the output control points for denormalizationy_std: Standard deviation of the output control points for denormalizationremoved_columns: Indices of dimensions with zero variance in the outputrbf: The underlying RBF interpolator
Implementations§
Source§impl RbfDeformer
impl RbfDeformer
Sourcepub fn new(
x: Vec<[f64; 3]>,
y: Vec<[f64; 3]>,
kernel_name: Option<&str>,
epsilon: Option<f64>,
) -> Result<Self>
pub fn new( x: Vec<[f64; 3]>, y: Vec<[f64; 3]>, kernel_name: Option<&str>, epsilon: Option<f64>, ) -> Result<Self>
Creates a new RbfDeformer instance.
§Arguments
x- Input control points (n×3 array)y- Corresponding output control points (n×3 array)kernel_name- Name of the kernel function to use (optional, defaults to “gaussian”):- “linear”: Linear kernel
- “cubic”: Cubic kernel
- “gaussian”: Gaussian kernel (default)
- “multiquadric”: Multiquadric kernel
- “inverse_multiquadratic”: Inverse multiquadric kernel
- “thin_plate_spline”: Thin plate spline kernel
epsilon- Bandwidth parameter for the kernel (optional, defaults to 1.0)
§Returns
A new RbfDeformer instance or an error if creation fails.
Sourcepub fn deform(&self, points: &[[f64; 3]]) -> Result<Vec<[f64; 3]>>
pub fn deform(&self, points: &[[f64; 3]]) -> Result<Vec<[f64; 3]>>
Deforms input points using the learned RBF transformation.
§Arguments
points- A slice of 3D points to transform
§Returns
A Vec of transformed points with the same length as the input, or an error string
if the transformation fails.
§Example
let points = [[0.5, 0.5, 0.5], [0.2, 0.8, 0.4]];
let deformed = deformer.deform(&points).unwrap();
assert_eq!(deformed.len(), 2);Auto Trait Implementations§
impl Freeze for RbfDeformer
impl RefUnwindSafe for RbfDeformer
impl Send for RbfDeformer
impl Sync for RbfDeformer
impl Unpin for RbfDeformer
impl UnsafeUnpin for RbfDeformer
impl UnwindSafe for RbfDeformer
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> 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