Contents
On this page
Triangle mesh object.
class triellipt.trimesh.TriMesh(points=None, triangs=None)
Triangle mesh.
Attributes
points : flat-complex-array
triangs : 3-column-int-table
Properties
| Name | Description |
|---|---|
triu |
Generator of triplot arguments. |
points2d |
Mesh points as two float rows. |
centrs2d |
Triangle centers as two float rows. |
TriMesh.submesh(self, *trinums)
Extracts a submesh.
Parameters
trinums : *int
Returns
TriMesh
TriMesh.deltriangs(self, *trinums)
Removes triangles from the mesh.
Parameters
trinums : *int
Returns
TriMesh
TriMesh.delghosts(self)
Removes ghost points from the mesh.
Returns
TriMesh
Notes
Related methods:
.hasghosts() shows if there are any ghosts.getghosts() returns ghost numbers, if anyTriMesh.getvoids(self)
Finds empty triangles (voids).
Returns
flat-int-array
Notes
Related methods:
.hasvoids() shows if there are any voids.delvoids() deletes voids from the meshTriMesh.alignnodes(self, *anchors)
Performs the edge-core ordering of the mesh nodes.
Parameters
anchors : *(float, float)
Returns
TriMesh | None
TriMesh.renumed(self, permuter)
Renumbers the mesh nodes.
Parameters
permuter : flat-int-array
Returns
TriMesh
TriMesh.meshedge(self)
Extracts the mesh edge.
Returns
MeshEdge
TriMesh.edgesmap(self)
Maps inner mesh edges.
Returns
EdgesMap
TriMesh.nodesmap(self)
Maps nodes to hosting triangles.
Returns
NodesMap
TriMesh.supertriu(self)
Creates a super triangulation.
Returns
SuperTriu
TriMesh.reduced(self, shrink=None, detach=False, seed=None)
Tries to compress the mesh.
Parameters
shrink : int = None
detach : bool = False
seed : (float, float) = None
Returns
TriMesh
Notes
(i) Number of shrinking steps after one compression event.
TriMesh.scaled(self, xcoeff, ycoeff)
Scales the mesh points by the specified parameters.
Parameters
xcoeff : float
ycoeff : float
Returns
TriMesh
TriMesh.split(self)
Splits the mesh into homogeneous parts.
Returns
list
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. |
MeshEdge.getloops(self)
Splits the mesh edge into loops.
Returns
list
EdgeLoop objects.
class triellipt.trimesh.EdgeLoop(mesh=None, data=None)
Loop on the mesh edge.
MeshEdge properties.EdgeLoop.synctoedge(self, edgeind)
Synchronizes to the specified segment.
Parameters
edgeind : int
Returns
EdgeLoop
EdgeLoop.synctonode(self, nodenum)
Synchronizes to the specified node.
Parameters
nodenum : int
Returns
EdgeLoop
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. |
EdgesMap.getspec(self)
Classifies triangles based on edges pairing.
Returns
dict
Notes
(i) Triangles categories:
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. |
NodesMap.atrank(self, rank)
Extracts data for nodes with the specified rank.
Parameters
rank : int
Returns
tuple
(nodnums, trinums, locnums) for the extracted nodes.
NodesMap.atnode(self, nodenum)
Extracts the map of a single node.
Parameters
nodenum : int
Returns
NodesMap
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:
SuperTriu.strip(self)
Remove links from a super-triangulation.
Notes
See EdgesMap.getspec() for links definition.
SuperTriu.smooth(self, iterate=True)
Removes heads and spots from a super-triangulation.
Parameters
iterate : bool = True
Notes
See EdgesMap.getspec() for heads and spots definition.
SuperTriu.detach(self)
Removes super-triangles touching the background mesh edge.
SuperTriu.reduce(self, seed=None, iterate=True)
Extracts a compact super-triangulation, if possible.
Parameters
seed : (float, float) = None
iterate : bool = True
Returns
SuperTriu | None
Notes
(a) Cleaning is a strip-and-smooth action.
(b) First super-triangle is used by default.
Copyright © 2023, Igor Semenov.