RBF#

class RBF(rbf, direction, grid)[source]#

Bases: Parametrization

Parametrize a point cloud using radial basis functions.

Parameters:
rbfscipy.interpolate.Rbf

Radial basis function interpolator instance.

directionstr

Direction of interpolation relative to positions.

grid: Tuple

2D interpolation grid ranges.

Methods

RBF.compute_normal(points)

Compute the normal vector at a given point on the surface.

RBF.fit(positions, *[, direction, function, ...])

Fit a radial basis function interpolant to a point cloud.

RBF.points_per_sampling(sampling_density[, ...])

Computes the approximate number of random samples required to achieve a given spatial sampling_density.

RBF.sample(n_samples[, normal_offset])

Sample points from the RBF.

compute_normal(points)[source]#

Compute the normal vector at a given point on the surface.

Parameters:
pointsnp.ndarray

Points on the surface with shape n x d

Returns:
np.ndarray

Normal vectors at the given points

classmethod fit(positions, *, direction='xz', function='linear', smooth=5, **kwargs)[source]#

Fit a radial basis function interpolant to a point cloud.

The input is downsampled before fitting. The RBF maps two coordinate axes to the third, controlled by direction.

Parameters:
positionsnp.ndarray

Point coordinates with shape (n, 3).

directionstr

Plane of the independent axes. 'xz' maps (x, z) -> y, 'yz' maps (y, z) -> x, 'xy' maps (x, y) -> z.

functionstr

Radial basis function type (e.g. 'linear', 'thin_plate', 'multiquadric', 'cubic').

smoothint

Smoothing factor passed to the RBF interpolator.

Returns:
RBF

Fitted RBF parametrization.

points_per_sampling(sampling_density, normal_offset=None)[source]#

Computes the approximate number of random samples required to achieve a given spatial sampling_density.

Parameters:
sampling_densityfloat

Average distance between points.

normal_offsetfloat, optional

Compute number of samples on offset parametrization, instead of current.

Returns:
int

Number of required random samples.

sample(n_samples, normal_offset=0.0, **kwargs)[source]#

Sample points from the RBF.

Parameters:
n_samplesint

Number of samples to draw

normal_offsetfloat, optional

Offset points by normal_offset times their normal vector.

Returns:
np.ndarray

Point coordinates (n, 3).