core

Module Contents

Classes

Attribute

Mesh attribute

AttributeCopyPolicy

Policy for copying attribute that is a view of an external buffer

AttributeCreatePolicy

Attribute creation policy

AttributeDeletePolicy

Policy for deleting attributes with reserved names

AttributeElement

Attribute element type

AttributeExportPolicy

Policy for exporting attribute that is a view of an external buffer

AttributeGrowthPolicy

Attribute growth policy (for external buffers)

AttributeShrinkPolicy

Attribute shrink policy (for external buffers)

AttributeUsage

Attribute usage type

AttributeWritePolicy

Policy for attempting to write to read-only external buffer

CentroidWeightingType

Centroid weighting type.

ConnectivityType

Mesh connectivity type

DistortionMetric

Distortion metric.

FacetAreaOptions

Options for computing facet area.

FacetCentroidOptions

Facet centroid options.

FacetNormalOptions

Facet normal computation options.

IndexedAttribute

MappingPolicy

Mapping policy for handling collisions.

MeshAreaOptions

Options for computing mesh area.

MeshCentroidOptions

Mesh centroid options.

MetaData

NormalOptions

Normal computation options.

NormalWeightingType

Normal weighting type.

RemapVerticesOptions

Options for remapping vertices.

SurfaceMesh

TangentBitangentOptions

Tangent bitangent options

TangentBitangentResult

Tangent bitangent result

VertexNormalOptions

Options for computing vertex normals

VertexValenceOptions

Vertex valence options

Functions

cast_attribute(mesh, input_attribute, dtype[, ...])

Cast an attribute to a new dtype.

combine_meshes(meshes[, preserve_attributes])

Combine a list of meshes into a single mesh.

compute_components(mesh[, output_attribute_name, ...])

Compute connected components.

compute_dihedral_angles(mesh[, output_attribute_name, ...])

Compute dihedral angles for each edge.

compute_dijkstra_distance(mesh, seed_facet, ...[, ...])

Compute Dijkstra distance from a seed facet.

compute_edge_lengths(mesh[, output_attribute_name])

Compute edge lengths.

compute_euler(mesh)

Compute the Euler characteristic.

compute_facet_area(…)

Compute facet area (Pythonic API).

compute_facet_centroid(…)

Compute facet centroid (Pythonic API).

compute_facet_normal(…)

Compute facet normal (Pythonic API).

compute_greedy_coloring(mesh[, element_type, ...])

Compute greedy coloring of mesh elements.

compute_mesh_area(…)

Compute mesh area (Pythonic API).

compute_mesh_centroid(…)

Compute mesh centroid (Pythonic API).

compute_normal(…)

Compute indexed normal attribute (Pythonic API).

compute_seam_edges(mesh, indexed_attribute_id[, ...])

Computer seam edges for a given indexed attribute.

compute_tangent_bitangent(…)

Compute tangent and bitangent vector attributes (Pythonic API).

compute_uv_distortion(mesh[, uv_attribute_name, ...])

Compute UV distortion.

compute_vertex_normal(…)

Computer vertex normal (Pythonic API).

compute_vertex_valence(…)

Compute vertex valence);

detect_degenerate_facets(mesh)

Detect degenerate facets in a mesh.

extract_submesh(mesh, selected_facets[, ...])

Extract a submesh based on the selected facets.

filter_attributes(mesh[, included_attributes, ...])

Filters the attributes of mesh according to user specifications.

is_edge_manifold(mesh)

Check if the mesh is edge manifold.

is_manifold(mesh)

Check if the mesh is manifold.

is_oriented(mesh)

Check if the mesh is oriented.

is_vertex_manifold(mesh)

Check if the mesh is vertex manifold.

map_attribute(…)

Map an attribute to a new element type.

map_attribute_in_place(…)

Map an attribute to a new element type in place.

normalize_mesh(mesh)

Normalize a mesh to fit into a unit box centered at the origin.

normalize_meshes(meshes)

Normalize a list of meshes to fit into a unit box centered at the origin.

permute_facets(mesh, new_to_old)

Reorder facets of a mesh in place based on a permutation.

permute_vertices(mesh, new_to_old)

Reorder vertices of a mesh in place based on a permutation.

remap_vertices(…)

Remap vertices of a mesh in place based on a permutation (Pythonic API).

remove_duplicate_facets(mesh[, consider_orientation])

Remove duplicate facets from a mesh.

remove_duplicate_vertices(mesh[, extra_attributes, ...])

Remove duplicate vertices from a mesh.

remove_isolated_vertices(mesh)

Remove isolated vertices from a mesh.

remove_null_area_facets(mesh[, null_area_threshold, ...])

Remove facets with unsigned facets area <= null_area_threhsold.

remove_topologically_degenerate_facets(mesh)

Remove topologically degenerate facets such as (0, 1, 1)

separate_by_components(mesh[, ...])

Extract a set of submeshes based on connected components.

separate_by_facet_groups(mesh, facet_group_indices[, ...])

Extract a set of submeshes based on facet groups.

transform_mesh(mesh, affine_transform[, ...])

Apply affine transformation to a mesh.

triangulate_polygonal_facets(mesh)

Triangulate polygonal facets of the mesh.

unify_index_buffer(…)

Unify the index buffer of the mesh for selected attributes.

weld_indexed_attribute(mesh, attribute_id[, ...])

Weld indexed attribute.

Attributes

class core.Attribute

Mesh attribute

property copy_policy: AttributeCopyPolicy

Copy policy of the attribute.

Return type:

AttributeCopyPolicy

property data: object

Raw data buffer of the attribute.

Return type:

object

property default_value: object

Default value of the attribute.

Return type:

object

property dtype: type | None

Value type of the attribute.

Return type:

type | None

property element_type: AttributeElement

Element type of the attribute.

Return type:

AttributeElement

property external: bool

Return true if the attribute wraps external buffer.

Return type:

bool

property growth_policy: AttributeGrowthPolicy

Growth policy of the attribute.

Return type:

AttributeGrowthPolicy

property num_channels: int

Number of channels in the attribute.

Return type:

int

property num_elements: int

Number of elements in the attribute.

Return type:

int

property readonly: bool

Return true if the attribute is read-only.

Return type:

bool

property shrink_policy: AttributeShrinkPolicy

Shrink policy of the attribute.

Return type:

AttributeShrinkPolicy

property usage: AttributeUsage

Usage of the attribute.

Return type:

AttributeUsage

property write_policy: AttributeWritePolicy

Write policy of the attribute.

Return type:

AttributeWritePolicy

clear()

Clear the attribute so it has no elements.

Return type:

None

create_internal_copy()

Create an internal copy of the attribute.

Return type:

None

empty()

Return true if the attribute is empty.

Return type:

bool

insert_elements(num_elements: int) None
insert_elements(tensor: object) None

Insert new elements to the attribute.

Parameters:

tensor – A tensor with shape (num_elements, num_channels) or (num_elements,).

reserve_entries(num_entries)

Reserve enough memory for num_entries entries.

Parameters:

num_entries (int) – Number of entries to reserve. It does not need to be a multiple of num_channels.

Return type:

None

class core.AttributeCopyPolicy(*args, **kwds)

Bases: enum.Enum

Policy for copying attribute that is a view of an external buffer

CopyIfExternal = 0

Copy attribute to internal buffer

ErrorIfExternal = 2

Error if external buffer is used

KeepExternalPtr = 1

Keep external buffer pointer

class core.AttributeCreatePolicy(*args, **kwds)

Bases: enum.Enum

Attribute creation policy

ErrorIfReserved = 0

Default policy, error if attribute name is reserved

Force = 1

Force create attribute even if name is reserved

class core.AttributeDeletePolicy(*args, **kwds)

Bases: enum.Enum

Policy for deleting attributes with reserved names

ErrorIfReserved = 0

Disallow deletion (default)

Force = 1

Force delete attribute

class core.AttributeElement

Bases: enum.IntEnum

Attribute element type

Corner = 8

Per-corner attribute

Edge = 4

Per-edge attribute

Facet = 2

Per-facet attribute

Indexed = 32

Indexed attribute

Value = 16

Value attribute not attached to any mesh elements

Vertex = 1

Per-vertex attribute

class core.AttributeExportPolicy(*args, **kwds)

Bases: enum.Enum

Policy for exporting attribute that is a view of an external buffer

CopyIfExternal = 0

Copy attribute to internal buffer

CopyIfUnmanaged = 1

Copy attribute to internal buffer if the external buffer is unmanaged (i.e. not reference counted)

ErrorIfExternal = 3

Error if external buffer is used

KeepExternalPtr = 2

Keep external buffer pointer

class core.AttributeGrowthPolicy(*args, **kwds)

Bases: enum.Enum

Attribute growth policy (for external buffers)

AllowWithinCapacity = 1

Allow growth as long as it is within the capacity of the external buffer

ErrorIfExtenal = 0

Disallow growth if external buffer is used (default)

SilentCopy = 3

Silently copy attribute to internal buffer when growth exceeds external buffer capacity

WarnAndCopy = 2

Warn and copy attribute to internal buffer when growth exceeds external buffer capacity

class core.AttributeShrinkPolicy(*args, **kwds)

Bases: enum.Enum

Attribute shrink policy (for external buffers)

ErrorIfExternal = 0

Disallow shrink if external buffer is used (default)

IgnoreIfExternal = 1

Ignore shrink if external buffer is used

SilentCopy = 3

Silently copy attribute to internal buffer when shrinking below external buffer capacity

WarnAndCopy = 2

Warn and copy attribute to internal buffer when shrinking below external buffer capacity

class core.AttributeUsage(*args, **kwds)

Bases: enum.Enum

Attribute usage type

Bitangent = 32

Bitangent attribute must have exactly dim channels

Color = 64

Color attribute may have 1, 2, 3 or 4 channels

CornerIndex = 1024

Single channel integer attribute indexing mesh corners

EdgeIndex = 2048

Single channel integer attribute indexing mesh edges

FacetIndex = 512

Single channel integer attribute indexing mesh facets

Normal = 8

Normal attribute must have exactly dim channels

Position = 4

Position attribute must have exactly dim channels

Scalar = 2

Scalar attribute that has exactly 1 channel

Tangent = 16

Tangent attribute must have exactly dim channels

UV = 128

UV attribute has exactly 2 channels

Vector = 1

Vector attribute that may have any number of channels

VertexIndex = 256

Single channel integer attribute indexing mesh vertices

class core.AttributeWritePolicy(*args, **kwds)

Bases: enum.Enum

Policy for attempting to write to read-only external buffer

ErrorIfReadOnly = 0

Disallow writing to read-only external buffer (default)

SilentCopy = 2

Silently copy attribute to internal buffer when writing to read-only external buffer

WarnAndCopy = 1

Warn and copy attribute to internal buffer when writing to read-only external buffer

class core.CentroidWeightingType(*args, **kwds)

Bases: enum.Enum

Centroid weighting type.

Area = 1

Area weighting.

Uniform = 0

Uniform weighting.

class core.ConnectivityType(*args, **kwds)

Bases: enum.Enum

Mesh connectivity type

Edge = 1

Two facets are connected if they share an edge

Vertex = 0

Two facets are connected if they share a vertex

class core.DistortionMetric(*args, **kwds)

Bases: enum.Enum

Distortion metric.

AreaRatio = 3

Area ratio

Dirichlet = 0

Dirichlet energy

InverseDirichlet = 1

Inverse Dirichlet energy

MIPS = 4

Most isotropic parameterization energy

SymmetricDirichlet = 2

Symmetric Dirichlet energy

class core.FacetAreaOptions

Options for computing facet area.

property output_attribute_name: str

The name of the output attribute.

Return type:

str

class core.FacetCentroidOptions

Facet centroid options.

property output_attribute_name: str

The name of the output attribute.

Return type:

str

class core.FacetNormalOptions

Facet normal computation options.

property output_attribute_name: str

@facet_normal

Type:

Output attribute name. Default

Return type:

str

class core.IndexedAttribute
property element_type: AttributeElement
Return type:

AttributeElement

property indices: Attribute
Return type:

Attribute

property num_channels: int
Return type:

int

property usage: AttributeUsage
Return type:

AttributeUsage

property values: Attribute
Return type:

Attribute

class core.MappingPolicy(*args, **kwds)

Bases: enum.Enum

Mapping policy for handling collisions.

Average = 0

Compute the average of the collided values.

Error = 2

Throw an error when collision happens.

KeepFirst = 1

Keep the first collided value.

class core.MeshAreaOptions

Options for computing mesh area.

property input_attribute_name: str

The name of the pre-computed facet area attribute, default is @facet_area’.

Return type:

str

property use_signed_area: bool

Whether to use signed area.

Return type:

bool

class core.MeshCentroidOptions

Mesh centroid options.

property facet_area_attribute_name: str

The name of the pre-computed facet area attribute if available.

Return type:

str

property facet_centroid_attribute_name: str

The name of the pre-computed facet centroid attribute if available.

Return type:

str

property weighting_type: CentroidWeightingType

The weighting type.

Return type:

CentroidWeightingType

class core.MetaData
__delitem__(arg, /)
Parameters:

arg (str)

Return type:

None

__getitem__(arg, /)
Parameters:

arg (str)

Return type:

str

__len__()
Return type:

int

__repr__()

Return repr(self).

Return type:

str

__setitem__(arg0, arg1, /)
Parameters:
  • arg0 (str)

  • arg1 (str)

Return type:

None

class core.NormalOptions

Normal computation options.

property facet_normal_attribute_name: str

Facet normal attribute name to use. Default is @facet_normal’.

Return type:

str

property keep_facet_normals: bool

Whether to keep the computed facet normal attribute. Default is false.

Return type:

bool

property output_attribute_name: str

@normal

Type:

Output attribute name. Default

Return type:

str

property recompute_facet_normals: bool

Whether to recompute facet normals. Default is false.

Return type:

bool

property weight_type: NormalWeightingType

Weighting type for normal computation. Default is Angle.

Return type:

NormalWeightingType

class core.NormalWeightingType(*args, **kwds)

Bases: enum.Enum

Normal weighting type.

Angle = 2

Weight by corner angle

CornerTriangleArea = 1

Weight by corner triangle area

Uniform = 0

Uniform weighting

class core.RemapVerticesOptions

Options for remapping vertices.

property collision_policy_float: MappingPolicy

The collision policy for float attributes.

Return type:

MappingPolicy

property collision_policy_integral: MappingPolicy

The collision policy for integral attributes.

Return type:

MappingPolicy

class core.SurfaceMesh(dimension=3)
Parameters:

dimension (int)

property attr_id_corner_to_edge: int
Return type:

int

property attr_id_corner_to_facet: int
Return type:

int

property attr_id_corner_to_vertex: int
Return type:

int

property attr_id_edge_to_first_corner: int
Return type:

int

property attr_id_facet_to_first_corner: int
Return type:

int

property attr_id_next_corner_around_edge: int
Return type:

int

property attr_id_next_corner_around_vertex: int
Return type:

int

property attr_id_vertex_to_first_corner: int
Return type:

int

property attr_id_vertex_to_position: int
Return type:

int

property dimension: int
Return type:

int

property facets: Annotated[numpy.typing.ArrayLike, dict(dtype='uint32', order='C', device='cpu')]

Facets of the mesh.

Return type:

Annotated[numpy.typing.ArrayLike, dict(dtype=’uint32’, order=’C’, device=’cpu’)]

property has_edges: bool
Return type:

bool

property is_hybrid: bool
Return type:

bool

property is_quad_mesh: bool
Return type:

bool

property is_regular: bool
Return type:

bool

property is_triangle_mesh: bool
Return type:

bool

property metadata: MetaData

Metadata of the mesh.

Return type:

MetaData

property num_corners: int
Return type:

int

property num_edges: int
Return type:

int

property num_facets: int
Return type:

int

property num_vertices: int
Return type:

int

property vertex_per_facet: int
Return type:

int

property vertices: Annotated[numpy.typing.ArrayLike, dict(dtype='float64', order='C', device='cpu')]

Vertices of the mesh.

Return type:

Annotated[numpy.typing.ArrayLike, dict(dtype=’float64’, order=’C’, device=’cpu’)]

attr_name_corner_to_edge: str = Ellipsis

The name of the attribute that stores the corner to edge mapping.

attr_name_corner_to_facet: str = Ellipsis

The name of the attribute that stores the corner to facet mapping.

attr_name_corner_to_vertex: str = Ellipsis

The name of the attribute that stores the corner to vertex mapping.

attr_name_edge_to_first_corner: str = Ellipsis

The name of the attribute that stores the edge to first corner mapping.

attr_name_facet_to_first_corner: str = Ellipsis

The name of the attribute that stores the facet to first corner mapping.

attr_name_next_corner_around_edge: str = Ellipsis

The name of the attribute that stores the next corner around edge mapping.

attr_name_next_corner_around_vertex: str = Ellipsis

The name of the attribute that stores the next corner around vertex mapping.

attr_name_vertex_to_first_corner: str = Ellipsis

The name of the attribute that stores the vertex to first corner mapping.

attr_name_vertex_to_position: str = Ellipsis

The name of the attribute that stores the vertex positions.

__attribute_ref_count__(arg, /)
Parameters:

arg (int)

Return type:

int

__copy__()

Create a shallow copy of this mesh.

Return type:

SurfaceMesh

__deepcopy__(memo=None)

Create a deep copy of this mesh.

Parameters:

memo (dict | None)

Return type:

SurfaceMesh

add_hybrid(arg0, arg1, /)
Parameters:
  • arg0 (Annotated[numpy.typing.ArrayLike, dict(dtype='uint32', order='C', device='cpu')])

  • arg1 (Annotated[numpy.typing.ArrayLike, dict(dtype='uint32', order='C', device='cpu')])

Return type:

None

add_polygon(arg, /)
Parameters:

arg (Annotated[numpy.typing.ArrayLike, dict(dtype='uint32', order='C', device='cpu')])

Return type:

None

add_polygons(arg, /)
Parameters:

arg (Annotated[numpy.typing.ArrayLike, dict(dtype='uint32', order='C', device='cpu')])

Return type:

None

add_quad(arg0, arg1, arg2, arg3, /)
Parameters:
  • arg0 (int)

  • arg1 (int)

  • arg2 (int)

  • arg3 (int)

Return type:

None

add_quads(arg, /)
Parameters:

arg (Annotated[numpy.typing.ArrayLike, dict(dtype='uint32', order='C', device='cpu')])

Return type:

None

add_triangle(arg0, arg1, arg2, /)
Parameters:
  • arg0 (int)

  • arg1 (int)

  • arg2 (int)

Return type:

None

add_triangles(arg, /)
Parameters:

arg (Annotated[numpy.typing.ArrayLike, dict(dtype='uint32', order='C', device='cpu')])

Return type:

None

add_vertex(vertex: Annotated[numpy.typing.ArrayLike, dict(dtype='float64', order='C', device='cpu')]) None
add_vertex(arg: list, /) None
add_vertices(arg, /)
Parameters:

arg (Annotated[numpy.typing.ArrayLike, dict(dtype='float64', order='C', device='cpu')])

Return type:

None

static attr_name_is_reserved(arg, /)
Parameters:

arg (str)

Return type:

bool

attribute(id: int, sharing: bool = True) Attribute
attribute(name: str, sharing: bool = True) Attribute

Get an attribute by name.

Parameters:
  • name (str) – Name of the attribute.

  • sharing (bool) – Whether to allow sharing the attribute with other meshes.

Returns:

The attribute.

clear_edges()
Return type:

None

clear_facets()
Return type:

None

clear_vertices()
Return type:

None

clone()

Create a deep copy of this mesh.

Return type:

object

compress_if_regular()
Return type:

None

count_num_corners_around_edge(arg, /)
Parameters:

arg (int)

Return type:

int

count_num_corners_around_vertex(arg, /)
Parameters:

arg (int)

Return type:

int

create_attribute(name, element=None, usage=None, initial_values=None, initial_indices=None, num_channels=None, dtype=None)

Create an attribute.

Parameters:
  • name (str) – Name of the attribute.

  • element (AttributeElement, optional) – Element type of the attribute. If None, derive from the shape of initial values.

  • usage (AttributeUsage, optional) – Usage type of the attribute. If None, derive from the shape of initial values or the number of channels.

  • initial_values (numpy.ndarray, optional) – Initial values of the attribute.

  • initial_indices (numpy.ndarray, optional) – Initial indices of the attribute (Indexed attribute only).

  • num_channels (int, optional) – Number of channels of the attribute.

  • dtype (valid numpy.dtype, optional) – Data type of the attribute.

Return type:

int

Note

If element is None, it will be derived based on the cardinality of the mesh elements. If there is an ambiguity, an exception will be raised. In addition, explicit element specification is required for value attributes.

Note

If usage is None, it will be derived based on the shape of initial_values or num_channels if specified.

Returns:

The id of the created attribute.

Parameters:
  • name (str)

  • element (AttributeElement | None)

  • usage (AttributeUsage | None)

  • initial_values (Annotated[numpy.typing.ArrayLike, dict(order='C', device='cpu')] | list | None)

  • initial_indices (Annotated[numpy.typing.ArrayLike, dict(dtype='uint32', order='C', device='cpu')] | Annotated[numpy.typing.ArrayLike, dict(order='C', device='cpu')] | list | None)

  • num_channels (int | None)

  • dtype (type | None)

Return type:

int

create_attribute_from(name, source_mesh, source_name='')

Shallow copy an attribute from another mesh.

Parameters:
  • name (str) – Name of the attribute.

  • source_mesh (SurfaceMesh) – Source mesh.

  • source_name (str, optional) – Name of the attribute in the source mesh. If empty, use the same name as name.

Returns:

The id of the created attribute.

Return type:

int

delete_attribute(name: str, policy: AttributeDeletePolicy) None
delete_attribute(name: str) None
delete_attribute(id: int) None

Delete an attribute by id.

Parameters:

id (AttributeId) – Id of the attribute.

duplicate_attribute(arg0, arg1, /)
Parameters:
  • arg0 (str)

  • arg1 (str)

Return type:

int

find_edge_from_vertices(arg0, arg1, /)
Parameters:
  • arg0 (int)

  • arg1 (int)

Return type:

int

get_attribute_id(arg, /)
Parameters:

arg (str)

Return type:

int

get_attribute_name(arg, /)
Parameters:

arg (int)

Return type:

str

get_corner_edge(arg, /)
Parameters:

arg (int)

Return type:

int

get_corner_facet(arg, /)
Parameters:

arg (int)

Return type:

int

get_corner_vertex(arg, /)
Parameters:

arg (int)

Return type:

int

get_edge(arg0, arg1, /)
Parameters:
  • arg0 (int)

  • arg1 (int)

Return type:

int

get_edge_vertices(arg, /)
Parameters:

arg (int)

Return type:

list[int]

get_facet_corner_begin(arg, /)
Parameters:

arg (int)

Return type:

int

get_facet_corner_end(arg, /)
Parameters:

arg (int)

Return type:

int

get_facet_size(arg, /)
Parameters:

arg (int)

Return type:

int

get_facet_vertex(arg0, arg1, /)
Parameters:
  • arg0 (int)

  • arg1 (int)

Return type:

int

get_facet_vertices(arg, /)
Parameters:

arg (int)

Return type:

Annotated[numpy.typing.ArrayLike, dict(dtype=’uint32’, order=’C’, device=’cpu’)]

get_first_corner_around_edge(arg, /)
Parameters:

arg (int)

Return type:

int

get_first_corner_around_vertex(arg, /)
Parameters:

arg (int)

Return type:

int

get_matching_attribute_id(element=None, usage=None, num_channels=0)

Get one matching attribute id with the desired element type, usage and number of channels.

Parameters:
  • element (AttributeElement | None) – The target element type. None matches all element types.

  • usage (AttributeUsage | None) – The target usage type. None matches all usage types.

  • num_channels (int) – The target number of channels. 0 matches arbitrary number of channels.

Returns:

An attribute id matching the target element, usage and number of channels, if found. None otherwise.

Return type:

int | None

get_matching_attribute_ids(element=None, usage=None, num_channels=0)

Get all matching attribute ids with the desired element type, usage and number of channels.

Parameters:
  • element (AttributeElement | None) – The target element type. None matches all element types.

  • usage (AttributeUsage | None) – The target usage type. None matches all usage types.

  • num_channels (int) – The target number of channels. 0 matches arbitrary number of channels.

Returns:

A list of attribute ids matching the target element, usage and number of channels.

Return type:

list[int]

get_next_corner_around_edge(arg, /)
Parameters:

arg (int)

Return type:

int

get_next_corner_around_vertex(arg, /)
Parameters:

arg (int)

Return type:

int

get_one_corner_around_edge(arg, /)
Parameters:

arg (int)

Return type:

int

get_one_corner_around_vertex(arg, /)
Parameters:

arg (int)

Return type:

int

get_one_facet_around_edge(arg, /)
Parameters:

arg (int)

Return type:

int

get_position(arg, /)
Parameters:

arg (int)

Return type:

Annotated[numpy.typing.ArrayLike, dict(dtype=’float64’, order=’C’, device=’cpu’)]

has_attribute(arg, /)
Parameters:

arg (str)

Return type:

bool

indexed_attribute(id: int, sharing: bool = True) IndexedAttribute
indexed_attribute(name: str, sharing: bool = True) IndexedAttribute

Get an indexed attribute by name.

Parameters:
  • name (str) – Name of the attribute.

  • sharing (bool) – Whether to allow sharing the attribute with other meshes.

Returns:

The indexed attribute.

initialize_edges(edges=None)

Initialize the edges.

The edges tensor provides a predefined ordering of the edges. If not provided, the edges are initialized in an arbitrary order.

Parameters:

edges (numpy.ndarray, optional) – M x 2 tensor of predefined edge vertex indices, where M is the number of edges.

Return type:

None

is_attribute_indexed(arg: int, /) bool
is_attribute_indexed(arg: str, /) bool
is_boundary_edge(arg, /)
Parameters:

arg (int)

Return type:

bool

ref_facet_vertices(arg, /)
Parameters:

arg (int)

Return type:

Annotated[numpy.typing.ArrayLike, dict(dtype=’uint32’, order=’C’, device=’cpu’)]

ref_position(arg, /)
Parameters:

arg (int)

Return type:

Annotated[numpy.typing.ArrayLike, dict(dtype=’float64’, order=’C’, device=’cpu’)]

remove_facets(arg: Annotated[numpy.typing.ArrayLike, dict(dtype='uint32', order='C', device='cpu')], /) None
remove_facets(facets: list) None

Remove selected facets from the mesh.

Parameters:

facets – list of facet indices to remove

remove_vertices(arg: Annotated[numpy.typing.ArrayLike, dict(dtype='uint32', order='C', device='cpu')], /) None
remove_vertices(vertices: list) None

Remove selected vertices from the mesh.

Parameters:

vertices – list of vertex indices to remove

rename_attribute(arg0, arg1, /)
Parameters:
  • arg0 (str)

  • arg1 (str)

Return type:

None

shrink_to_fit()
Return type:

None

wrap_as_attribute(name, element, usage, values)

Wrap an existing numpy array as an attribute.

Parameters:
  • name (str) – Name of the attribute.

  • element (AttributeElement) – Element type of the attribute.

  • usage (AttributeUsage) – Usage type of the attribute.

  • values (numpy.ndarray) – Values of the attribute.

Returns:

The id of the created attribute.

Return type:

int

wrap_as_facets(tensor: Annotated[numpy.typing.ArrayLike, dict(dtype='uint32', order='C', device='cpu')], num_facets: int, vertex_per_facet: int) int
wrap_as_facets(offsets: Annotated[numpy.typing.ArrayLike, dict(dtype='uint32', order='C', device='cpu')], num_facets: int, facets: Annotated[numpy.typing.ArrayLike, dict(dtype='uint32', order='C', device='cpu')], num_corners: int) int

Wrap a tensor as a list of hybrid facets.

Parameters:
  • offsets (numpy.ndarray) – The offset indices into the facets array.

  • num_facets (int) – Number of facets.

  • facets (numpy.ndarray) – The indices of the vertices of the facets.

  • num_corners (int) – Number of corners.

Returns:

The id of the wrapped facet attribute.

wrap_as_indexed_attribute(name, usage, values, indices)

Wrap an existing numpy array as an indexed attribute.

Parameters:
  • name (str) – Name of the attribute.

  • usage (AttributeUsage) – Usage type of the attribute.

  • values (numpy.ndarray) – Values of the attribute.

  • indices (numpy.ndarray) – Indices of the attribute.

Returns:

The id of the created attribute.

Return type:

int

wrap_as_vertices(tensor, num_vertices)

Wrap a tensor as vertices.

Parameters:
  • tensor (numpy.ndarray) – The tensor to wrap.

  • num_vertices (int) – Number of vertices.

Returns:

The id of the wrapped vertices attribute.

Return type:

int

class core.TangentBitangentOptions

Tangent bitangent options

property bitangent_attribute_name: str

The name of the output bitangent attribute, default is @bitangent

Return type:

str

property normal_attribute_name: str

The name of the normal attribute

Return type:

str

property output_element_type: AttributeElement

The output element type

Return type:

AttributeElement

property pad_with_sign: bool

Whether to pad the output tangent/bitangent with sign

Return type:

bool

property tangent_attribute_name: str

The name of the output tangent attribute, default is @tangent

Return type:

str

property uv_attribute_name: str

The name of the uv attribute

Return type:

str

class core.TangentBitangentResult

Tangent bitangent result

property bitangent_id: int

The output bitangent attribute id

Return type:

int

property tangent_id: int

The output tangent attribute id

Return type:

int

class core.VertexNormalOptions

Options for computing vertex normals

property keep_weighted_corner_normals: bool

Whether to keep the weighted corner normal attribute. Default is false.

Return type:

bool

property output_attribute_name: str

Output attribute name. Default is @vertex_normal’.

Return type:

str

property recompute_weighted_corner_normals: bool

Whether to recompute weighted corner normals. Default is false

Return type:

bool

property weight_type: NormalWeightingType

Weighting type for normal computation. Default is Angle.

Return type:

NormalWeightingType

property weighted_corner_normal_attribute_name: str

Precomputed weighted corner normals attribute name.Default is @weighted_corner_normal’. If attribute exists, the weighted corner normals will be used instead of recomputing them.

Return type:

str

class core.VertexValenceOptions

Vertex valence options

property induced_by_attribute: str

Optional per-edge attribute used as indicator function to restrict the graph used for vertex valence computation

Return type:

str

property output_attribute_name: str

The name of the output attribute

Return type:

str

core.cast_attribute(mesh, input_attribute, dtype, output_attribute_name=None)

Cast an attribute to a new dtype.

Parameters:
  • mesh (SurfaceMesh) – The input mesh.

  • input_attribute (int | str) – The input attribute id or name.

  • dtype (type) – The new dtype.

  • output_attribute_name (str | None) – The output attribute name. If none, cast will replace the input attribute.

Returns:

The id of the new attribute.

Return type:

int

core.combine_meshes(meshes, preserve_attributes=True)

Combine a list of meshes into a single mesh.

Parameters:
  • meshes (list[SurfaceMesh]) – input meshes

  • preserve_attributes (bool) – whether to preserve attributes

Returns:

the combined mesh

Return type:

SurfaceMesh

core.compute_components(mesh, output_attribute_name=None, connectivity_type=None, blocker_elements=None)

Compute connected components.

This method will create a per-facet component id attribute named by the output_attribute_name argument. Each component id is in [0, num_components-1] range.

Parameters:
  • mesh (SurfaceMesh) – The input mesh.

  • output_attribute_name (str | None) – The name of the output attribute.

  • connectivity_type (ConnectivityType | None) – The connectivity type. Either “Vertex” or “Edge”.

  • blocker_elements (list | None) – The list of blocker element indices. If connectivity_type is Edge, facets adjacent to a blocker edge are not considered as connected through this edge. If connectivity_type is Vertex, facets sharing a blocker vertex are not considered as connected through this vertex.

Returns:

The total number of components.

Return type:

int

core.compute_dihedral_angles(mesh, output_attribute_name=None, facet_normal_attribute_name=None, recompute_facet_normals=None, keep_facet_normals=None)

Compute dihedral angles for each edge.

The dihedral angle of an edge is defined as the angle between the __normals__ of two facets adjacent to the edge. The dihedral angle is always in the range [0, pi] for manifold edges. For boundary edges, the dihedral angle defaults to 0. For non-manifold edges, the dihedral angle is not well-defined and will be set to the special value 2 * M_PI.

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

  • output_attribute_name (str | None) – The optional edge attribute name to store the dihedral angles.

  • facet_normal_attribute_name (str | None) – The optional attribute name to store the facet normals.

  • recompute_facet_normals (bool | None) – Whether to recompute facet normals.

  • keep_facet_normals (bool | None) – Whether to keep newly computed facet normals. It has no effect on pre-existing facet normals.

Returns:

The edge attribute id of dihedral angles.

Return type:

int

core.compute_dijkstra_distance(mesh, seed_facet, barycentric_coords, radius=None, output_attribute_name='@dijkstra_distance', output_involved_vertices=False)

Compute Dijkstra distance from a seed facet.

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

  • seed_facet (int) – The seed facet index.

  • barycentric_coords (list) – The barycentric coordinates of the seed facet.

  • radius (float | None) – The maximum radius of the dijkstra distance.

  • output_attribute_name (str) – The output attribute name to store the dijkstra distance.

  • output_involved_vertices (bool) – Whether to output the list of involved vertices.

Return type:

list[int] | None

core.compute_edge_lengths(mesh, output_attribute_name=None)

Compute edge lengths.

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

  • output_attribute_name (str | None) – The optional edge attribute name to store the edge lengths.

Returns:

The edge attribute id of edge lengths.

Return type:

int

core.compute_euler(mesh)

Compute the Euler characteristic.

Parameters:

mesh (SurfaceMesh) – The source mesh.

Returns:

The Euler characteristic.

Return type:

int

core.compute_facet_area(mesh: SurfaceMesh, options: FacetAreaOptions = ...) int
core.compute_facet_area(mesh: SurfaceMesh, output_attribute_name: str | None = None) int

Compute facet area (Pythonic API).

Parameters:
  • mesh – The input mesh.

  • output_attribute_name – The name of the output attribute.

Returns:

The id of the new attribute.

core.compute_facet_centroid(mesh: SurfaceMesh, options: FacetCentroidOptions = ...) int
core.compute_facet_centroid(mesh: SurfaceMesh, output_attribute_name: str | None = None) int

Compute facet centroid (Pythonic API).

Parameters:
  • mesh – The input mesh.

  • output_attribute_name – The name of the output attribute.

Returns:

The id of the new attribute.

core.compute_facet_normal(mesh: SurfaceMesh, options: FacetNormalOptions = ...) int
core.compute_facet_normal(mesh: SurfaceMesh, output_attribute_name: str | None = None) int

Compute facet normal (Pythonic API).

Parameters:
  • mesh – Input mesh.

  • output_attribute_name – Output attribute name.

Returns:

Facet normal attribute id.

core.compute_greedy_coloring(mesh, element_type=AttributeElement.Facet, num_color_used=8, output_attribute_name=None)

Compute greedy coloring of mesh elements.

Parameters:
  • mesh (SurfaceMesh) – Input mesh.

  • element_type (AttributeElement) – Element type to be colored. Can be either Vertex or Facet.

  • num_color_used (int) – Minimum number of colors to use. The algorithm will cycle through them but may use more.

  • output_attribute_name (str | None) – Output attribute name.

Returns:

Color attribute id.

Return type:

int

core.compute_mesh_area(mesh: SurfaceMesh, options: MeshAreaOptions = ...) float
core.compute_mesh_area(mesh: SurfaceMesh, input_attribute_name: str | None = None, use_signed_area: bool | None = None) float

Compute mesh area (Pythonic API).

Parameters:
  • mesh – The input mesh.

  • input_attribute_name – The name of the pre-computed facet area attribute.

  • use_signed_area – Whether to use signed area.

Returns:

The mesh area.

core.compute_mesh_centroid(mesh: SurfaceMesh, options: MeshCentroidOptions = ...) list[float]
core.compute_mesh_centroid(mesh: SurfaceMesh, weighting_type: CentroidWeightingType | None = None, facet_centroid_attribute_name: str | None = None, facet_area_attribute_name: str | None = None) list[float]

Compute mesh centroid (Pythonic API).

Parameters:
  • mesh – The input mesh.

  • weighting_type – The weighting type. Default is Area.

  • facet_centroid_attribute_name – The name of the pre-computed facet centroid attribute if available. Default is @facet_centroid’.

  • facet_area_attribute_name – The name of the pre-computed facet area attribute if available. Default is @facet_area’.

Returns:

The mesh centroid.

core.compute_normal(mesh: SurfaceMesh, feature_angle_threshold: float = 0.7853981633974483, cone_vertices: object | None = None, options: NormalOptions | None = None) int
core.compute_normal(mesh: SurfaceMesh, feature_angle_threshold: float = 0.7853981633974483, cone_vertices: object | None = None, output_attribute_name: str | None = None, weight_type: NormalWeightingType | None = None, facet_normal_attribute_name: str | None = None, recompute_facet_normals: bool | None = None, keep_facet_normals: bool | None = None) int

Compute indexed normal attribute (Pythonic API).

Parameters:
  • mesh (SurfaceMesh) – input mesh

  • feature_angle_threshold (float, optional) – feature angle threshold

  • cone_vertices (list[int] or numpy.ndarray, optional) – cone vertices

  • output_attribute_name (str, optional) – output normal attribute name

  • weight_type (NormalWeightingType, optional) – normal weighting type

  • facet_normal_attribute_name (str, optional) – facet normal attribute name

  • recompute_facet_normals (bool, optional) – whether to recompute facet normals

  • keep_facet_normals (bool, optional) – whether to keep the computed facet normal attribute

Returns:

the id of the indexed normal attribute.

core.compute_seam_edges(mesh, indexed_attribute_id, output_attribute_name=None)

Computer seam edges for a given indexed attribute.

Parameters:
  • mesh (SurfaceMesh) – Input mesh.

  • indexed_attribute_id (int) – Input indexed attribute id.

  • output_attribute_name (str | None) – Output attribute name.

Returns:

Attribute id for the output per-edge seam attribute (1 is a seam, 0 is not).

Return type:

int

core.compute_tangent_bitangent(mesh: SurfaceMesh, options: TangentBitangentOptions = ...) TangentBitangentResult
core.compute_tangent_bitangent(mesh: SurfaceMesh, tangent_attribute_name: str | None = None, bitangent_attribute_name: str | None = None, uv_attribute_name: str | None = None, normal_attribute_name: str | None = None, output_attribute_type: AttributeElement | None = None, pad_with_sign: bool | None = None) tuple[int, int]

Compute tangent and bitangent vector attributes (Pythonic API).

Parameters:
  • mesh – The input mesh.

  • tangent_attribute_name – The name of the output tangent attribute.

  • bitangent_attribute_name – The name of the output bitangent attribute.

  • uv_attribute_name – The name of the uv attribute.

  • normal_attribute_name – The name of the normal attribute.

  • output_attribute_type – The output element type.

  • pad_with_sign – Whether to pad the output tangent/bitangent with sign.

Returns:

The tangent and bitangent attribute ids

core.compute_uv_distortion(mesh, uv_attribute_name='@uv', output_attribute_name='@uv_measure', metric=DistortionMetric.MIPS)

Compute UV distortion.

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

  • uv_attribute_name (str) – The input UV attribute name. Default is “@uv”.

  • output_attribute_name (str) – The output attribute name to store the distortion. Default is “@uv_measure”.

  • metric (DistortionMetric) – The distortion metric. Default is MIPS.

Returns:

The facet attribute id for distortion.

Return type:

int

core.compute_vertex_normal(mesh: SurfaceMesh, options: VertexNormalOptions = ...) int
core.compute_vertex_normal(mesh: SurfaceMesh, output_attribute_name: str | None = None, weight_type: NormalWeightingType | None = None, weighted_corner_normal_attribute_name: str | None = None, recompute_weighted_corner_normals: bool | None = None, keep_weighted_corner_normals: bool | None = None) int

Computer vertex normal (Pythonic API).

Parameters:
  • mesh – Input mesh.

  • output_attribute_name – Output attribute name.

  • weight_type – Weighting type for normal computation.

  • weighted_corner_normal_attribute_name – Precomputed weighted corner normals attribute name.

  • recompute_weighted_corner_normals – Whether to recompute weighted corner normals.

  • keep_weighted_corner_normals – Whether to keep the weighted corner normal attribute.

Returns:

Vertex normal attribute id.

core.compute_vertex_valence(mesh: SurfaceMesh, options: VertexValenceOptions = ...) int
core.compute_vertex_valence(mesh: SurfaceMesh, output_attribute_name: str | None = None, induced_by_attribute: str | None = None) int

Compute vertex valence);

Parameters:
  • mesh – The input mesh.

  • output_attribute_name – The name of the output attribute.

  • induced_by_attribute – Optional per-edge attribute used as indicator function to restrict the graph used for vertex valence computation.

Returns:

The vertex valence attribute id

core.detect_degenerate_facets(mesh)

Detect degenerate facets in a mesh.

Parameters:

mesh (SurfaceMesh) – The input mesh.

Returns:

A list of indices of degenerate facets.

Return type:

list[int]

core.extract_submesh(mesh, selected_facets, source_vertex_attr_name='', source_facet_attr_name='', map_attributes=False)

Extract a submesh based on the selected facets.

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

  • selected_facets (Annotated[numpy.typing.ArrayLike, dict(dtype='uint32', order='C', device='cpu')]) – A listed of facet ids to extract.

  • source_vertex_attr_name (str) – The optional attribute name to track source vertices.

  • source_facet_attr_name (str) – The optional attribute name to track source facets.

  • map_attributes (bool) – Map attributes from the source to target meshes.

Returns:

A mesh that contains only the selected facets.

Return type:

SurfaceMesh

core.filter_attributes(mesh, included_attributes=None, excluded_attributes=None, included_usages=None, included_element_types=None)

Filters the attributes of mesh according to user specifications.

Parameters:
  • mesh (SurfaceMesh) – Input mesh.

  • included_attributes (collections.abc.Sequence[int | str] | None) – List of attribute names or ids to include. By default, all attributes are included.

  • excluded_attributes (collections.abc.Sequence[int | str] | None) – List of attribute names or ids to exclude. By default, no attribute is excluded.

  • included_usages (collections.abc.Set[AttributeUsage] | None) – List of attribute usages to include. By default, all usages are included.

  • included_element_types (collections.abc.Set[AttributeElement] | None) – List of attribute element types to include. By default, all element types are included.

Return type:

SurfaceMesh

core.is_edge_manifold(mesh)

Check if the mesh is edge manifold.

Parameters:

mesh (SurfaceMesh) – The source mesh.

Returns:

Whether the mesh is edge manifold.

Return type:

bool

core.is_manifold(mesh)

Check if the mesh is manifold.

A mesh considered as manifold if it is both vertex and edge manifold.

Parameters:

mesh (SurfaceMesh) – The source mesh.

Returns:

Whether the mesh is manifold.

Return type:

bool

core.is_oriented(mesh)

Check if the mesh is oriented.

Parameters:

mesh (SurfaceMesh) – The source mesh.

Returns:

Whether the mesh is oriented.

Return type:

bool

core.is_vertex_manifold(mesh)

Check if the mesh is vertex manifold.

Parameters:

mesh (SurfaceMesh) – The source mesh.

Returns:

Whether the mesh is vertex manifold.

Return type:

bool

core.map_attribute(mesh: SurfaceMesh, old_attribute_id: int, new_attribute_name: str, new_element: AttributeElement) int
core.map_attribute(mesh: SurfaceMesh, old_attribute_name: str, new_attribute_name: str, new_element: AttributeElement) int

Map an attribute to a new element type.

Parameters:
  • mesh – The input mesh.

  • old_attribute_name – The name of the input attribute.

  • new_attribute_name – The name of the new attribute.

  • new_element – The new element type.

Returns:

The id of the new attribute.

core.map_attribute_in_place(mesh: SurfaceMesh, id: int, new_element: AttributeElement) int
core.map_attribute_in_place(mesh: SurfaceMesh, name: str, new_element: AttributeElement) int

Map an attribute to a new element type in place.

Parameters:
  • mesh – The input mesh.

  • name – The name of the input attribute.

  • new_element – The new element type.

Returns:

The id of the new attribute.

core.normalize_mesh(mesh)

Normalize a mesh to fit into a unit box centered at the origin.

Parameters:

mesh (SurfaceMesh) – input mesh

Return type:

None

core.normalize_meshes(meshes)

Normalize a list of meshes to fit into a unit box centered at the origin.

Parameters:

meshes (collections.abc.Sequence[SurfaceMesh]) – input meshes

Return type:

None

core.permute_facets(mesh, new_to_old)

Reorder facets of a mesh in place based on a permutation.

Parameters:
  • mesh (SurfaceMesh) – input mesh

  • new_to_old (Annotated[numpy.typing.ArrayLike, dict(dtype='uint32', order='C', device='cpu')]) – permutation vector for facets

Return type:

None

core.permute_vertices(mesh, new_to_old)

Reorder vertices of a mesh in place based on a permutation.

Parameters:
  • mesh (SurfaceMesh) – input mesh

  • new_to_old (Annotated[numpy.typing.ArrayLike, dict(dtype='uint32', order='C', device='cpu')]) – permutation vector for vertices

Return type:

None

core.remap_vertices(mesh: SurfaceMesh, old_to_new: Annotated[numpy.typing.ArrayLike, dict(dtype='uint32', order='C', device='cpu')], options: RemapVerticesOptions = ...) None
core.remap_vertices(mesh: SurfaceMesh, old_to_new: Annotated[numpy.typing.ArrayLike, dict(dtype='uint32', order='C', device='cpu')], collision_policy_float: MappingPolicy | None = None, collision_policy_integral: MappingPolicy | None = None) None

Remap vertices of a mesh in place based on a permutation (Pythonic API).

Parameters:
  • mesh – input mesh

  • old_to_new – permutation vector for vertices

  • collision_policy_float – The collision policy for float attributes.

  • collision_policy_integral – The collision policy for integral attributes.

core.remove_duplicate_facets(mesh, consider_orientation=False)

Remove duplicate facets from a mesh.

Facets of different orientations (e.g. (0, 1, 2) and (2, 1, 0)) are considered as duplicates. If both orientations have equal number of duplicate facets, all of them are removed. If one orientation has more duplicate facets, all but one facet with the majority orientation are removed.

Parameters:
  • mesh (SurfaceMesh) – The input mesh. The mesh is modified in place.

  • consider_orientation (bool) – Whether to consider orientation when detecting duplicate facets.

Return type:

None

core.remove_duplicate_vertices(mesh, extra_attributes=None, boundary_only=False)

Remove duplicate vertices from a mesh.

Parameters:
  • mesh (SurfaceMesh) – The input mesh.

  • extra_attributes (collections.abc.Sequence[int] | None) – Two vertices are considered duplicates if they have the same position and the same values for all attributes in extra_attributes.

  • boundary_only (bool) – Only remove duplicate vertices on the boundary.

Return type:

None

core.remove_isolated_vertices(mesh)

Remove isolated vertices from a mesh.

Parameters:

mesh (SurfaceMesh) – The input mesh for inplace modification.

Return type:

None

core.remove_null_area_facets(mesh, null_area_threshold=0, remove_isolated_vertices=False)

Remove facets with unsigned facets area <= null_area_threhsold.

Parameters:
  • mesh (SurfaceMesh) – The input mesh.

  • null_area_threshold (float) – The area threshold below which a facet is considered as null facet.

  • remove_isolated_vertices (bool) – Whether to remove isolated vertices after removing null area facets.

Return type:

None

core.remove_topologically_degenerate_facets(mesh)

Remove topologically degenerate facets such as (0, 1, 1)

For general polygons, topologically degeneracy means that the polygon is made of at most two unique vertices. E.g. a quad of the form (0, 0, 1, 1) is degenerate, while a quad of the form (1, 1, 2, 3) is not.

Parameters:

mesh (SurfaceMesh) – The input mesh for inplace modification.

Return type:

None

core.separate_by_components(mesh, source_vertex_attr_name='', source_facet_attr_name='', map_attributes=False, connectivity_type=ConnectivityType.Edge)

Extract a set of submeshes based on connected components.

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

  • source_vertex_attr_name (str) – The optional attribute name to track source vertices.

  • source_facet_attr_name (str) – The optional attribute name to track source facets.

  • map_attributes (bool) – Map attributes from the source to target meshes.

  • connectivity_type (ConnectivityType) – The connectivity used for component computation.

Returns:

A list of meshes, one for each connected component.

Return type:

list[SurfaceMesh]

core.separate_by_facet_groups(mesh, facet_group_indices, source_vertex_attr_name='', source_facet_attr_name='', map_attributes=False)

Extract a set of submeshes based on facet groups.

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

  • facet_group_indices (Annotated[numpy.typing.ArrayLike, dict(dtype='uint32', order='C', device='cpu')]) – The group index for each facet. Each group index must be in the range of [0, max(facet_group_indices)]

  • source_vertex_attr_name (str) – The optional attribute name to track source vertices.

  • source_facet_attr_name (str) – The optional attribute name to track source facets.

  • map_attributes (bool)

Returns:

A list of meshes, one for each facet group.

Return type:

list[SurfaceMesh]

core.transform_mesh(mesh, affine_transform, normalize_normals=True, normalize_tangents_bitangents=True, in_place=True)

Apply affine transformation to a mesh.

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

  • affine_transform (Annotated[numpy.typing.ArrayLike, dict(dtype='float64', shape=(4, 4), order='F')]) – The affine transformation matrix.

  • normalize_normals (bool) – Whether to normalize normals.

  • normalize_tangents_bitangents (bool) – Whether to normalize tangents and bitangents.

  • in_place (bool) – Whether to apply the transformation in place.

Returns:

The transformed mesh if in_place is False.

Return type:

SurfaceMesh | None

core.triangulate_polygonal_facets(mesh)

Triangulate polygonal facets of the mesh.

Parameters:

mesh (SurfaceMesh) – The input mesh.

Return type:

None

core.unify_index_buffer(mesh: SurfaceMesh) SurfaceMesh
core.unify_index_buffer(mesh: SurfaceMesh, attribute_ids: collections.abc.Sequence[int]) SurfaceMesh
core.unify_index_buffer(mesh: SurfaceMesh, attribute_names: collections.abc.Sequence[str]) SurfaceMesh

Unify the index buffer of the mesh for selected attributes.

Parameters:
  • mesh (SurfaceMesh) – The mesh to unify.

  • attribute_names (list of str) – The selected attribute names to unify.

Returns:

The unified mesh.

core.weld_indexed_attribute(mesh, attribute_id, epsilon_rel=None, epsilon_abs=None)

Weld indexed attribute.

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

  • attribute_id (int) – The indexed attribute id to weld.

  • epsilon_rel (float | None) – The relative tolerance for welding.

  • epsilon_abs (float | None) – The absolute tolerance for welding.

Return type:

None

core.invalid_index: int = 4294967295
core.invalid_scalar: float