Compact Triangulation¶
Pipeline description¶
This example demonstrates how to invoke the CompactTriangulation data structure in TTK.
The example first loads a triangle mesh from disk. An elevation function along the y-axis is then computed and added on top of the mesh using the Elevation
filter.
Then, the example uses TriangulationManager to initialize a clustering of the mesh vertices. The clustering information is saved into a new scalar field named ttkCompactTriangulationIndex
. The number associated with each vertex by ttkCompactTriangulationIndex
represents the cluster index to which the vertex belongs.
Once a scalar field named ttkCompactTriangulationIndex
is defined on a dataset, any TTK plugin applied to such dataset will be executed using the CompactTriangulation
data structure.
The example continues applying the ScalarFieldCriticalPoints module on the elevation function previously defined on the input mesh.
ParaView¶
To reproduce the above screenshot, go to your ttk-data directory and enter the following command:
paraview states/compactTriangulation.pvsm
Python code¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
|
To run the above Python script, go to your ttk-data directory and enter the following command:
pvpython python/compactTriangulation.py
Inputs¶
- dragon.vtu: a two-dimensional triangulation.
Outputs¶
CompactTriangulation.vtu
: the input dataset in VTK file format with an additional scalar field namedttkCompactTriangulationIndex
that stores the cluster index for each vertex.CriticalPoints.vtp
: the output critical points in VTK file format. You are free to change thevtp
file extension to that of any other supported file format (e.g.csv
) in the above python script.