SplineCurve#
- class SplineCurve(positions, order=1, **kwargs)[source]#
Bases:
ParametrizationParametrize a point cloud as a spline curve.
- Parameters:
- positionsnp.ndarray
Control points defining the spline curve
Methods
SplineCurve.compute_normal(points)Compute the normal vector at a given point on the surface.
SplineCurve.fit(positions, *[, order])Fit a spline curve through a point cloud.
SplineCurve.points_per_sampling(sampling_density)Computes the approximate number of random samples required to achieve a given spatial sampling_density.
SplineCurve.sample(n_samples[, normal_offset])Samples points from the surface of 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, *, order=1, **kwargs)[source]#
Fit a spline curve through a point cloud.
- Parameters:
- positionsnp.ndarray
Control points with shape (n, 3). Order along the curve is inferred from cumulative chord lengths.
- orderint
Spline degree.
1= linear,3= cubic spline.
- Returns:
- SplineCurve
Fitted spline curve.
- 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 the parametrization.
- Parameters:
- n_samplesint
Number of samples to draw
- normal_offsetfloat, optional
Offset points by normal_offset times their normal vector.
- *argsList
Additional arguments
- **kwargsDict
Additional keywoard arguments.
- Returns:
- np.ndarray
Point coordinates (n, 3).