Triangle Mesh: Difference between revisions
m (note cgal) |
m (→See also) |
||
Line 67: | Line 67: | ||
[[Category:FAQ]] | [[Category:FAQ]] | ||
[[Category:HowTo]] | [[Category:HowTo]] | ||
[[Category: Vector]] |
Latest revision as of 18:04, 31 December 2013
Triangle Meshes and TINs
GRASS DEM workflow generally does not include TINs. Due to its very strong raster engine and tools it has never had the need to resort to them, and so historically it just never happened. This page describes how a user can go about working with TIN data if they want to anyway (for whatever reason).
More sophisticated DEM creation tools in GRASS can be found in the v.surf.* and r.surf.* modules, particularly v.surf.rst, v.surf.bspline and r.surf.contour, but there are others, including the r.surf.nnbathy add-on module. See the Contour lines to DEM wiki page for a detailed comparison of these modules and a TIN.
Generation of triangle meshes may be needed as input for numeric modeling applications. To create these there are tools such as SeaGrid, GridPak, and GridGen (site archive/follow r.surf.nnbathy addon module links to find Pavel Sakov's updated contact info). See the ROMS Ocean Model wiki for tutorials on how to use those.
FAQ
Q: I have some coastal data that is in the form of a triangle mesh where the triangles are of different sizes. The triangles are subdivided the closer they get to the coast. Each vertex in the triangle set holds the water height at that location. Each vertex also has a lat/lon associated with it. I want to get this data into GRASS, how?
A: You can import the triangular mesh as a vector file by first importing the nodes with v.in.ascii and by creating a three column table (as you have three water elevation values) linked to the id number of each node. To create the triangular mesh run v.delaunay (see map example in its manual page).
TIN data is really just point data with lines drawn between points. So if you can extract the x,y,z coordinate at each node you can build a much nicer raster surface than a TIN using one of the v.surf.* modules.
GRASS raster maps work on a 2D grid of cells with constant North-South and East-West resolution (but NS and EW resolutions may differ). If the highest resolution data would make your raster unmanageably large, you can zoom in to a small region to make the higher res map, then create additional medium and coarse resolution maps at a wider zoom level. Finally you could switch back to the fine resolution and display all three maps overlaying each other. GRASS will over-sample the low-res maps as needed.
How to create a 3D TIN
Point network
- Import x,y,z nodes with v.in.ascii
- Convert to raster with v.to.rast, or import/convert points with r.in.xyz, then use the r.surf.nnbathy module with the "l" algorithm. See the Contour lines to DEM wiki page for details.
or
- Use v.delaunay3d GRASS 7 AddOn by Martin Landa (2013) to create a 3D TIN using CGAL library.
or
- Use the new version of v.delaunay by Martin Pavlovsky (2008) to create a triangle network and transform triangle areas to 3D faces. (TODO: improve and expand this entry!)
ParaView
This is a micro-howto about how to create 3D TINs from 3D vector points. The resulting TIN is saved as a DXF file, that can be imported into GRASS or used with CAD programs.
First you need to install Paraview (http://www.paraview.org) and MeshLab (http://meshlab.sourceforge.net/).
Then,
- Export your 3d points as a VTK file;
- In Paraview (see also GRASS and Paraview), open the vtk file, click on Apply, then go to Filters-Alphabetical-Delaunay 2D (need to click apply again). click on the name of the just-created mesh and go to file-save data. Save it as a PLY file.
- Open the PLY in MEshLab and save as a DXF. If you open the dxf in a text editor, you will see the lovely 3DFACE. :) Note: For GRASS 7 there is a v.in.ply addon
If imported it back into GRASS, it will be imported as FACES.
good luck!
TIN with "breaklines"
This wiki-page explain how to construct TIN with "breaklines" in GRASS with the module <v.triangle>, which use <Triangle> utility.
See also
- r.refine - simplifying a grid terrain into a TIN (triangular irregular network)
- v.trimesh creates a triangular mesh from a vector map using areal constraints for refinement. It uses Jonathan Shewchuk's Triangle library.
- Triangulation in GRASS and VTK
- Gmsh - A three-dimensional finite element mesh generator (GPL>=2, available as a standard Debian/Ubuntu package)
- CGAL - C++ library of efficient and reliable geometric algorithms