Geometry Constructors and Extractors

New in version 5.0.

construct module provides functions for constructing and extracting parametric shapes. A surface can be constructed from curves and a volume can be constructed from surfaces. Moreover, a surface can be extracted to curves and a volume can be extracted to surfaces in all parametric directions.

Function Reference

geomdl.construct.construct_surface(direction, *args, **kwargs)

Generates surfaces from curves.

Arguments:
  • args: a list of curve instances
Keyword Arguments (optional):
  • degree: degree of the 2nd parametric direction
  • knotvector: knot vector of the 2nd parametric direction
  • rational: flag to generate rational surfaces
Parameters:direction (str) – the direction that the input curves lies, i.e. u or v
Returns:Surface constructed from the curves on the given parametric direction
geomdl.construct.construct_volume(direction, *args, **kwargs)

Generates volumes from surfaces.

Arguments:
  • args: a list of surface instances
Keyword Arguments (optional):
  • degree: degree of the 3rd parametric direction
  • knotvector: knot vector of the 3rd parametric direction
  • rational: flag to generate rational volumes
Parameters:direction (str) – the direction that the input surfaces lies, i.e. u, v, w
Returns:Volume constructed from the surfaces on the given parametric direction
geomdl.construct.extract_curves(psurf, **kwargs)

Extracts curves from a surface.

The return value is a dict object containing the following keys:

  • u: the curves which generate u-direction (or which lie on the v-direction)
  • v: the curves which generate v-direction (or which lie on the u-direction)

As an example; if a curve lies on the u-direction, then its knotvector is equal to surface’s knotvector on the v-direction and vice versa.

The curve extraction process can be controlled via extract_u and extract_v boolean keyword arguments.

Parameters:psurf (abstract.Surface) – input surface
Returns:extracted curves
Return type:dict
geomdl.construct.extract_isosurface(pvol)

Extracts the largest isosurface from a volume.

The following example illustrates one of the usage scenarios:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
from geomdl import construct, multi
from geomdl.visualization import VisMPL

# Assuming that "myvol" variable stores your spline volume information
isosrf = construct.extract_isosurface(myvol)

# Create a surface container to store extracted isosurface
msurf = multi.SurfaceContainer(isosrf)

# Set visualization components
msurf.vis = VisMPL.VisSurface(VisMPL.VisConfig(ctrlpts=False))

# Render isosurface
msurf.render()
Parameters:pvol (abstract.Volume) – input volume
Returns:isosurface (as a tuple of surfaces)
Return type:tuple
geomdl.construct.extract_surfaces(pvol)

Extracts surfaces from a volume.

Parameters:pvol (abstract.Volume) – input volume
Returns:extracted surface
Return type:dict