Tessellation

The tessellate module provides tessellation algorithms for surfaces. The following example illustrates the usage scenario of the tessellation algorithms with surfaces.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
from geomdl import NURBS
from geomdl import tessellate

# Create a surface instance
surf = NURBS.Surface()

# Set tessellation algorithm (you can use another algorithm)
surf.tessellator = tessellate.TriangularTessellate()

# Tessellate surface
surf.tessellate()

NURBS-Python uses TriangularTessellate class for surface tessellation by default.

Abstract Tessellator

class geomdl.tessellate.AbstractTessellate(**kwargs)

Bases: object

Abstract base class for tessellation algorithms.

arguments

Arguments passed to the tessellation function.

This property allows customization of the tessellation algorithm, and mainly designed to allow users to pass additional arguments to the tessellation function or change the behavior of the algorithm at runtime. This property can be thought as a way to input and store extra data for the tessellation functionality.

Getter:Gets the tessellation arguments
Setter:Sets the tessellation arguments
faces

Objects generated after tessellation.

Getter:Gets the faces
Type:elements.AbstractEntity
is_tessellated()

Checks if vertices and faces are generated.

Returns:tessellation status
Return type:bool
reset()

Clears stored vertices and faces.

tessellate(points, **kwargs)

Abstract method for the implementation of the tessellation algorithm.

This algorithm should update vertices and faces properties.

Note

This is an abstract method and it must be implemented in the subclass.

Parameters:points – points to be tessellated
vertices

Vertex objects generated after tessellation.

Getter:Gets the vertices
Type:elements.AbstractEntity

Triangular Tessellator

class geomdl.tessellate.TriangularTessellate(**kwargs)

Bases: geomdl.tessellate.AbstractTessellate

Triangular tessellation algorithm for surfaces.

This class provides the default triangular tessellation algorithm for surfaces.

arguments

Arguments passed to the tessellation function.

This property allows customization of the tessellation algorithm, and mainly designed to allow users to pass additional arguments to the tessellation function or change the behavior of the algorithm at runtime. This property can be thought as a way to input and store extra data for the tessellation functionality.

Getter:Gets the tessellation arguments
Setter:Sets the tessellation arguments
faces

Objects generated after tessellation.

Getter:Gets the faces
Type:elements.AbstractEntity
is_tessellated()

Checks if vertices and faces are generated.

Returns:tessellation status
Return type:bool
reset()

Clears stored vertices and faces.

tessellate(points, **kwargs)

Applies triangular tessellation.

This function does not check if the points have already been tessellated.

Keyword Arguments:
  • size_u: number of points on the u-direction
  • size_v: number of points on the v-direction
Parameters:points (list or tuple) – list of points
vertices

Vertex objects generated after tessellation.

Getter:Gets the vertices
Type:elements.AbstractEntity