Triangle Mesh: Difference between revisions

From GRASS-Wiki
Jump to navigation Jump to search
(+ r.refine)
Line 47: Line 47:
good luck!
good luck!


== See also ==
* [http://www.bowdoin.edu/~ltoma/research.html r.refine - simplifying a grid terrain into a TIN] (triangular irregular network)


[[Category: FAQ]]
[[Category: FAQ]]

Revision as of 14:05, 5 November 2008

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 and r.surf.contour, but there are others, including the r.surf.nnbathy add-on module.


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.

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

TODO: improve and expand this entry!

  • Import x,y,z nodes with v.in.ascii, as above.
  • Use the new version of v.delaunay by Martin Pavlovsky (2008) to create a triangle network and transform triangle areas to 3D faces.


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,

  1. Export your 3d points as a VTK file;
  2. In 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.
  3. 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. :)

If imported it back into GRASS, it will be imported as FACES.

good luck!

See also