Ellipsoid#

class Ellipsoid(radii, center, orientations)[source]#

Bases: Parametrization

Parametrize a point cloud as ellipsoid.

Parameters:
radiinp.ndarray

Radii of the ellipse along each axis

centernp.ndarray

Center of the ellipse along each axis

orientationsnp.ndarray

Square orientation matrix

Methods

Ellipsoid.compute_distance(points, **kwargs)

Computes the distance between points and the parameterization.

Ellipsoid.compute_normal(points)

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

Ellipsoid.fit(positions, **kwargs)

Fit an ellipsoid to a point cloud.

Ellipsoid.points_per_sampling(sampling_density)

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

Ellipsoid.sample(n_samples[, normal_offset])

Samples points from the surface of an ellisoid.

compute_distance(points, **kwargs)[source]#

Computes the distance between points and the parameterization.

Parameters:
pointsnp.ndarray

Array of coordinates (n, d).

Returns:
np.ndarray

Distances between points and the parametrization.

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, **kwargs)[source]#

Fit an ellipsoid to a point cloud.

Uses eigenvalue decomposition to solve for the three semi-axis radii, center, and orientation matrix.

Parameters:
positionsnp.ndarray

Point coordinates with shape (n, 3).

Returns:
Ellipsoid

Fitted ellipsoid with estimated radii, center, and orientation.

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]#

Samples points from the surface of an ellisoid.

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).