Geometric Operations

This module provides common geometric operations for curves and surfaces. It includes the following operations:

  • Curve and surface splitting / Bézier decomposition
  • Tangent, normal and binormal evaluations
  • Hodograph curve and surface computations
  • Translation

Function Reference

geomdl.operations.add_dimension(obj, **kwargs)

Converts x-dimensional curve to a (x+1)-dimensional curve.

If you pass inplace=True keyword argument, the input shape will be updated. Otherwise, this function does not change the input shape but returns a new instance of the same shape with the updated data.

Useful when converting a 2-dimensional curve to a 3-dimensional curve.

Parameters:obj (abstract.Curve) – Curve
Returns:updated Curve
Return type:BSpline.Curve or NURBS.Curve
geomdl.operations.binormal(obj, params, **kwargs)

Evaluates the binormal vector of the curves or surfaces at the input parameter values.

This function is designed to evaluate binormal vectors of the B-Spline and NURBS shapes at single or multiple parameter positions.

Parameters:
Returns:

a list containing “point” and “vector” pairs

Return type:

tuple

geomdl.operations.decompose_curve(obj, **kwargs)

Decomposes the curve into Bezier curve segments of the same degree.

This operation does not modify the input curve, instead it returns the split curve segments.

Parameters:obj (abstract.Curve) – Curve to be decomposed
Returns:a list of curve objects arranged in Bezier curve segments
Return type:list
geomdl.operations.decompose_surface(obj, **kwargs)

Decomposes the surface into Bezier surface patches of the same degree.

This operation does not modify the input surface, instead it returns the surface patches.

Parameters:obj (abstract.Surface) – surface
Returns:a list of surface objects arranged as Bezier surface patches
Return type:multi.SurfaceContainer
geomdl.operations.derivative_curve(obj)

Computes the hodograph (first derivative) curve of the input curve.

This function constructs the hodograph (first derivative) curve from the input curve by computing the degrees, knot vectors and the control points of the derivative curve.

Parameters:obj (abstract.Curve) – input curve
Returns:derivative curve
geomdl.operations.derivative_surface(obj)

Computes the hodograph (first derivative) surface of the input surface.

This function constructs the hodograph (first derivative) surface from the input surface by computing the degrees, knot vectors and the control points of the derivative surface.

The return value of this function is a tuple containing the following derivative surfaces in the given order:

  • U-derivative surface (derivative taken only on the u-direction)
  • V-derivative surface (derivative taken only on the v-direction)
  • UV-derivative surface (derivative taken on both the u- and the v-direction)
Parameters:obj (abstract.Surface) – input surface
Returns:derivative surfaces w.r.t. u, v and both u-v
Return type:tuple
geomdl.operations.find_ctrlpts(obj, u, v=None, **kwargs)

Finds the control points involved in the evaluation of the curve/surface point defined by the input parameter(s).

Parameters:
  • obj (abstract.Curve or abstract.Surface) – curve or surface
  • u (float) – parameter (for curve), parameter on the u-direction (for surface)
  • v (float) – parameter on the v-direction (for surface only)
Returns:

control points; 1-dimensional array for curve, 2-dimensional array for surface

Return type:

list

geomdl.operations.length_curve(obj)

Computes the approximate length of the parametric curve.

Parameters:obj (abstract.Curve) – input curve
Returns:length
Return type:float
geomdl.operations.normal(obj, params, **kwargs)

Evaluates the normal vector of the curves or surfaces at the input parameter values.

This function is designed to evaluate normal vectors of the B-Spline and NURBS shapes at single or multiple parameter positions.

Parameters:
Returns:

a list containing “point” and “vector” pairs

Return type:

tuple

geomdl.operations.rotate(obj, angle, **kwargs)

Rotates curves, surfaces or volumes about the chosen axis.

Keyword Arguments:
  • axis: rotation axis; x, y, z correspond to 0, 1, 2 respectively.
  • inplace: if True, the input shape is modified. Default: False
Parameters:
Returns:

rotated geometry object

geomdl.operations.scale(obj, multiplier, **kwargs)

Scales curves, surfaces or volumes by the input multiplier.

Keyword Arguments:
  • inplace: if True, the input shape is modified. Default: False
Parameters:
Returns:

scaled geometry object

geomdl.operations.split_curve(obj, u, **kwargs)

Splits the curve at the input parametric coordinate.

This method splits the curve into two pieces at the given parametric coordinate, generates two different curve objects and returns them. It does not modify the input curve.

Parameters:
Returns:

list of curves as the split pieces of the initial curve

Return type:

list

geomdl.operations.split_surface_u(obj, t, **kwargs)

Splits the surface at the input parametric coordinate on the u-direction.

This method splits the surface into two pieces at the given parametric coordinate on the u-direction, generates two different surface objects and returns them. It does not modify the input surface.

Parameters:
  • obj (abstract.Surface) – surface
  • t (float) – parameter for the u-direction
Returns:

list of surface as the split pieces of the initial surface

Return type:

list

geomdl.operations.split_surface_v(obj, t, **kwargs)

Splits the surface at the input parametric coordinate on the v-direction.

This method splits the surface into two pieces at the given parametric coordinate on the v-direction, generates two different surface objects and returns them. It does not modify the input surface.

Parameters:
  • obj (abstract.Surface) – surface
  • t (float) – parameter for the v-direction
Returns:

list of surface as the split pieces of the initial surface

Return type:

list

geomdl.operations.tangent(obj, params, **kwargs)

Evaluates the tangent vector of the curves or surfaces at the input parameter values.

This function is designed to evaluate tangent vectors of the B-Spline and NURBS shapes at single or multiple parameter positions.

Parameters:
Returns:

a list containing “point” and “vector” pairs

Return type:

tuple

geomdl.operations.translate(obj, vec, **kwargs)

Translates curves, surface or volumes by the input vector.

If you pass inplace=True keyword argument, the input shape will be updated. Otherwise, this function does not change the input shape but returns a new instance of the same shape with the updated data.

Parameters:
Returns:

translated geometry object

geomdl.operations.transpose(surf, **kwargs)

Transposes the input surface by swapping u and v parametric directions.

If you pass inplace=True keyword argument, the input surface will be updated. Otherwise, this function does not change the input surface but returns a new instance of the same surface with the updated data.

Parameters:surf (abstract.Surface) – input surface
Returns:transposed surface
Return type:abstract.Surface