Curve and Surface Fitting

fitting module provides functions for interpolating and approximating B-spline curves and surfaces from points. It provides functions for global interpolation and approximation to a list of data points. Please see the following functions for details:

Function Reference

geomdl.fitting.interpolate_curve(points, degree, **kwargs)

Curve interpolation through the data points.

Please refer to Algorithm A9.1 on The NURBS Book (2nd Edition), pp.369-370 for details.

Keyword Arguments:
  • centripetal: activates centripetal parametrization method. Default: False
Parameters:
  • points (list, tuple) – data points
  • degree (int) – degree of the output parametric curve
Returns:

interpolated B-Spline curve

Return type:

BSpline.Curve

geomdl.fitting.interpolate_surface(points, size_u, size_v, degree_u, degree_v, **kwargs)

Surface interpolation through the data points.

Please refer to the Algorithm A9.4 on The NURBS Book (2nd Edition), pp.380 for details.

Keyword Arguments:
  • centripetal: activates centripetal parametrization method. Default: False
Parameters:
  • points (list, tuple) – data points
  • size_u (int) – number of data points on the u-direction
  • size_v (int) – number of data points on the v-direction
  • degree_u (int) – degree of the output surface for the u-direction
  • degree_v (int) – degree of the output surface for the v-direction
Returns:

interpolated B-Spline surface

Return type:

BSpline.Surface

geomdl.fitting.approximate_curve(points, degree, **kwargs)

Curve approximation using least squares method with fixed number of control points.

Please refer to The NURBS Book (2nd Edition), pp.410-413 for details.

Keyword Arguments:
  • centripetal: activates centripetal parametrization method. Default: False
  • ctrlpts_size: number of control points. Default: len(points) - 1
Parameters:
  • points (list, tuple) – data points
  • degree (int) – degree of the output parametric curve
Returns:

approximated B-Spline curve

Return type:

BSpline.Curve

geomdl.fitting.approximate_surface(points, size_u, size_v, degree_u, degree_v, **kwargs)

Surface approximation using least squares method with fixed number of control points.

This algorithm interpolates the corner control points and approximates the remaining control points. Please refer to Algorithm A9.7 of The NURBS Book (2nd Edition), pp.422-423 for details.

Keyword Arguments:
  • centripetal: activates centripetal parametrization method. Default: False
  • ctrlpts_size_u: number of control points on the u-direction. Default: size_u - 1
  • ctrlpts_size_v: number of control points on the v-direction. Default: size_v - 1
Parameters:
  • points (list, tuple) – data points
  • size_u (int) – number of data points on the u-direction, r
  • size_v (int) – number of data points on the v-direction, s
  • degree_u (int) – degree of the output surface for the u-direction
  • degree_v (int) – degree of the output surface for the v-direction
Returns:

approximated B-Spline surface

Return type:

BSpline.Surface