Contents

On this page


triellipt.trimesh

Triangle mesh object.

TriMesh

class triellipt.trimesh.TriMesh(points=None, triangs=None)

Triangle mesh.

Attributes

points : flat-complex-array

Mesh points in a complex plane.

triangs : 3-column-int-table

Triangles vertices in CCW order.

Properties

Name Description
triu Generator of triplot arguments.
points2d Mesh points as two float rows.
centrs2d Triangle centers as two float rows.

submesh()

TriMesh.submesh(self, *trinums)

Extracts a submesh.

Parameters

trinums : *int

Numbers of triangles to include.

Returns

TriMesh

New mesh object.

deltriangs()

TriMesh.deltriangs(self, *trinums)

Removes triangles from the mesh.

Parameters

trinums : *int

Numbers of triangles to delete.

Returns

TriMesh

New mesh object.

delghosts()

TriMesh.delghosts(self)

Removes ghost points from the mesh.

Returns

TriMesh

New mesh.

Notes

Related methods:

getvoids()

TriMesh.getvoids(self)

Finds empty triangles (voids).

Returns

flat-int-array

Numbers of empty triangles.

Notes

Related methods:

alignnodes()

TriMesh.alignnodes(self, *anchors)

Performs the edge-core ordering of the mesh nodes.

Parameters

anchors : *(float, float)

Points to synchronize the mesh boundary.

Returns

TriMesh | None

New mesh, or None if the mesh boundary can not be fetched.

renumed()

TriMesh.renumed(self, permuter)

Renumbers the mesh nodes.

Parameters

permuter : flat-int-array

Permutation of mesh nodes.

Returns

TriMesh

New mesh with the nodes renumbered.

meshedge()

TriMesh.meshedge(self)

Extracts the mesh edge.

Returns

MeshEdge

Mesh edge object.

edgesmap()

TriMesh.edgesmap(self)

Maps inner mesh edges.

Returns

EdgesMap

Map of inner mesh edges.

nodesmap()

TriMesh.nodesmap(self)

Maps nodes to hosting triangles.

Returns

NodesMap

Nodes-to-triangles map.

supertriu()

TriMesh.supertriu(self)

Creates a super triangulation.

Returns

SuperTriu

Super triangulation object.

reduced()

TriMesh.reduced(self, shrink=None, detach=False, seed=None)

Tries to compress the mesh.

Parameters

shrink : int = None

Controls shrinking of super-triangulations (i).

detach : bool = False

Runs the edge detachment before compression, if True.

seed : (float, float) = None

Seed point to start reduction.

Returns

TriMesh

New mesh.

Notes

(i) Number of shrinking steps after one compression event.

scaled()

TriMesh.scaled(self, xcoeff, ycoeff)

Scales the mesh points by the specified parameters.

Parameters

xcoeff : float

Scale factor for the x-coordinate.

ycoeff : float

Scale factor for the y-coordinate.

Returns

TriMesh

New mesh with the nodes scaled.

split()

TriMesh.split(self)

Splits the mesh into homogeneous parts.

Returns

list

List of homogeneous submeshes.

MeshEdge

class triellipt.trimesh.MeshEdge(mesh=None, data=None)

Mesh edge object.

Properties

Primary data:

Name Description
trinums Host triangles (HT) across edges.
locnums Local numbers of edges in HTs

Nodes numbers:

Name Description
nodnums1 Start nodes across edges.
nodnums2 End nodes across edges.
nodnums3 Apexes across edges.

Tables:

Name Description
edges2d Edges as two rows of nodes numbers.
nodes2d Start nodes positions as two float rows.

Unique values:

Name Description
nodnums_unique Unique numbers of edge points.
trinums_unique Unique numbers of edge triangles.

getloops()

MeshEdge.getloops(self)

Splits the mesh edge into loops.

Returns

list

A list of EdgeLoop objects.

EdgeLoop

class triellipt.trimesh.EdgeLoop(mesh=None, data=None)

Loop on the mesh edge.

synctoedge()

EdgeLoop.synctoedge(self, edgeind)

Synchronizes to the specified segment.

Parameters

edgeind : int

Index of the segment to synchronize to.

Returns

EdgeLoop

New loop.

synctonode()

EdgeLoop.synctonode(self, nodenum)

Synchronizes to the specified node.

Parameters

nodenum : int

Global node number to synchronize to.

Returns

EdgeLoop

New loop.

EdgesMap

class triellipt.trimesh.EdgesMap(mesh=None, data=None)

Map of inner mesh edges.

Properties

Name Description
trinums1 Host triangle one (T1).
trinums2 Host triangle two (T2).
locnums1 Local edge number in T1.
locnums2 Local edge number in T2.

getspec()

EdgesMap.getspec(self)

Classifies triangles based on edges pairing.

Returns

dict

Triangles numbers for each category (i).

Notes

(i) Triangles categories:

NodesMap

class triellipt.trimesh.NodesMap(mesh=None, data=None)

Nodes-to-triangles map.

Properties

Nodes data:

Name Description
nodnums Global numbers.
trinums Host triangles (HTs).
locnums Local numbers in HTs.

Neighbors local numbers:

Name Description
locnums1 Next CCW node.
locnums2 Next-next CCW node.

Neighbors global numbers:

Name Description
nodnums1 Next CCW node.
nodnums2 Next-next CCW node.

atrank()

NodesMap.atrank(self, rank)

Extracts data for nodes with the specified rank.

Parameters

rank : int

Rank of the nodes to extract.

Returns

tuple

Triplet (nodnums, trinums, locnums) for the extracted nodes.

atnode()

NodesMap.atnode(self, nodenum)

Extracts the map of a single node.

Parameters

nodenum : int

Number of the target node.

Returns

NodesMap

The resulting single-node map.

SuperTriu

class triellipt.trimesh.SuperTriu(mesh=None, data=None)

Super triangulation.

Properties

General:

Name Description
trinums Numbers of host triangles.
kermesh Submesh of host triangles.
supmesh Mesh from super-vertices.

Neighbors:

Name Description
trinums1 1st CCW neighbor.
trinums2 2nd CCW neighbor.
trinums3 3rd CCW neighbor.

Super-vertices:

Name Description
nodnums1 1st CCW vertex.
nodnums2 2nd CCW vertex.
nodnums3 3rd CCW vertex.

Notes

Non-standard nodes pairing for supmesh-kermesh transition:

strip()

SuperTriu.strip(self)

Remove links from a super-triangulation.

Notes

See EdgesMap.getspec() for links definition.

smooth()

SuperTriu.smooth(self, iterate=True)

Removes heads and spots from a super-triangulation.

Parameters

iterate : bool = True

Runs smoothing until possible, if True.

Notes

See EdgesMap.getspec() for heads and spots definition.

detach()

SuperTriu.detach(self)

Removes super-triangles touching the background mesh edge.

reduce()

SuperTriu.reduce(self, seed=None, iterate=True)

Extracts a compact super-triangulation, if possible.

Parameters

seed : (float, float) = None

Seed point to start reduction (b).

iterate : bool = True

Triggers cleaning and retry in case of failure (a).

Returns

SuperTriu | None

Compact super-triangulation or None, if failed.

Notes

(a) Cleaning is a strip-and-smooth action.

(b) First super-triangle is used by default.


Copyright © 2023, Igor Semenov.