subdivision

Module Contents

Classes

FaceVaryingInterpolation

Create a collection of name/value pairs.

InterpolatedAttributesSelection

Create a collection of name/value pairs.

SchemeType

Create a collection of name/value pairs.

VertexBoundaryInterpolation

Create a collection of name/value pairs.

Functions

subdivide_mesh(mesh, num_levels[, scheme, adaptive, ...])

Evaluates the subdivision surface of a polygonal mesh.

class subdivision.FaceVaryingInterpolation(*args, **kwds)

Bases: enum.Enum

Create a collection of name/value pairs.

Example enumeration:

>>> class Color(Enum):
...     RED = 1
...     BLUE = 2
...     GREEN = 3

Access them by:

  • attribute access:

>>> Color.RED
<Color.RED: 1>
  • value lookup:

>>> Color(1)
<Color.RED: 1>
  • name lookup:

>>> Color['RED']
<Color.RED: 1>

Enumerations can be iterated over, and know how many members they have:

>>> len(Color)
3
>>> list(Color)
[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]

Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.

All = 5
Boundaries = 4
CornersOnly = 1
CornersPlus1 = 2
CornersPlus2 = 3
Smooth = 0
class subdivision.InterpolatedAttributesSelection(*args, **kwds)

Bases: enum.Enum

Create a collection of name/value pairs.

Example enumeration:

>>> class Color(Enum):
...     RED = 1
...     BLUE = 2
...     GREEN = 3

Access them by:

  • attribute access:

>>> Color.RED
<Color.RED: 1>
  • value lookup:

>>> Color(1)
<Color.RED: 1>
  • name lookup:

>>> Color['RED']
<Color.RED: 1>

Enumerations can be iterated over, and know how many members they have:

>>> len(Color)
3
>>> list(Color)
[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]

Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.

All = 0
Empty = 1
Selected = 2
class subdivision.SchemeType(*args, **kwds)

Bases: enum.Enum

Create a collection of name/value pairs.

Example enumeration:

>>> class Color(Enum):
...     RED = 1
...     BLUE = 2
...     GREEN = 3

Access them by:

  • attribute access:

>>> Color.RED
<Color.RED: 1>
  • value lookup:

>>> Color(1)
<Color.RED: 1>
  • name lookup:

>>> Color['RED']
<Color.RED: 1>

Enumerations can be iterated over, and know how many members they have:

>>> len(Color)
3
>>> list(Color)
[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]

Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.

Bilinear = 0
CatmullClark = 1
Loop = 2
class subdivision.VertexBoundaryInterpolation(*args, **kwds)

Bases: enum.Enum

Create a collection of name/value pairs.

Example enumeration:

>>> class Color(Enum):
...     RED = 1
...     BLUE = 2
...     GREEN = 3

Access them by:

  • attribute access:

>>> Color.RED
<Color.RED: 1>
  • value lookup:

>>> Color(1)
<Color.RED: 1>
  • name lookup:

>>> Color['RED']
<Color.RED: 1>

Enumerations can be iterated over, and know how many members they have:

>>> len(Color)
3
>>> list(Color)
[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]

Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.

EdgeAndCorner = 2
EdgeOnly = 1
NoInterpolation = 0
subdivision.subdivide_mesh(mesh, num_levels, scheme=None, adaptive=False, max_edge_length=None, vertex_boundary_interpolation=VertexBoundaryInterpolation.EdgeOnly, face_varying_interpolation=FaceVaryingInterpolation.Smooth, use_limit_surface=False, interpolated_attributes_selection=InterpolatedAttributesSelection.All, interpolated_smooth_attributes=None, interpolated_linear_attributes=None, edge_sharpness_attr=None, vertex_sharpness_attr=None, face_hole_attr=None, output_limit_normals=None, output_limit_tangents=None, output_limit_bitangents=None)

Evaluates the subdivision surface of a polygonal mesh.

Parameters:
  • mesh (lagrange.core.SurfaceMesh) – The source mesh.

  • num_levels (int) – The number of levels of subdivision to apply.

  • scheme (SchemeType | None) – The subdivision scheme to use.

  • adaptive (bool) – Whether to use adaptive subdivision.

  • max_edge_length (float | None) – The maximum edge length for adaptive subdivision.

  • vertex_boundary_interpolation (VertexBoundaryInterpolation) – Vertex boundary interpolation rule.

  • face_varying_interpolation (FaceVaryingInterpolation) – Face-varying interpolation rule.

  • use_limit_surface (bool) – Interpolate all data to the limit surface.

  • edge_sharpness_attr (int | None) – Per-edge scalar attribute denoting edge sharpness. Sharpness values must be in [0, 1] (0 means smooth, 1 means sharp).

  • vertex_sharpness_attr (int | None) – Per-vertex scalar attribute denoting vertex sharpness (e.g. for boundary corners). Sharpness values must be in [0, 1] (0 means smooth, 1 means sharp).

  • face_hole_attr (int | None) – Per-face integer attribute denoting face holes. A non-zero value means the facet is a hole. If a face is tagged as a hole, the limit surface will not be generated for that face.

  • output_limit_normals (str | None) – Output name for a newly computed per-vertex attribute containing the normals to the limit surface. Skipped if left empty.

  • output_limit_tangents (str | None) – Output name for a newly computed per-vertex attribute containing the tangents (first derivatives) to the limit surface. Skipped if left empty.

  • output_limit_bitangents (str | None) – Output name for a newly computed per-vertex attribute containing the bitangents (second derivative) to the limit surface. Skipped if left empty.

  • interpolated_attributes_selection (InterpolatedAttributesSelection)

  • interpolated_smooth_attributes (collections.abc.Sequence[int] | None)

  • interpolated_linear_attributes (collections.abc.Sequence[int] | None)

Returns:

The subdivided mesh.

Return type:

lagrange.core.SurfaceMesh