Here a small python example to triangulate vector points from the nc
demo data set
with the VTK delaunay filter class:
# The purpose of this example is
# to read a grass vector map without topology information
# into the VTK poly data format and processing that map with vtkDelaunay2D.
# The processed data is written as VTK XML file to the file system
# Init grass variables
init = vtkGRASSInit()
# Now build the pipeline
# read the vector map without creating topology
reader = vtkGRASSVectorPolyDataReader() # The reader does not need
topology information
reader.SetVectorName("elev_lid792_randpts")
# Setup the delaunay triangulation
delaunay = vtkDelaunay2D()
delaunay.SetInputConnection(reader.GetOutputPort())
# write the data as XML with base64 encoding
writer = vtkXMLPolyDataWriter()
writer.SetFileName("/tmp/test.vtk")
writer.SetInputConnection(delaunay.GetOutputPort())
writer.Write()
Thanks
I will maybe add some content about the project there.
But first i need to add some content to the google code wiki.
And my time is sooo limited ...
Here a small python example to triangulate vector points from the nc
demo data set with the VTK delaunay filter class:
Curiosity: how much faster is this compared to v.delaunay or likewise?
The VTK Version is twice as fast, but does not write the data back to
grass and therefor
do not build a topology in grass.
The VTK output is base64 XML written to /tmp.
time v.delaunay -r input=elev_lid792_randpts@user1 output=test2 --o
WARNING: Vector map <test2> already exists and will be overwritten
Building topology for vector map <test2>...
Registering primitives...
17948 primitives registered
35896 vertices registered
Building areas...
100%
11949 areas built
1 isles built
Number of nodes: 6000
Number of primitives: 17948
Number of points: 0
Number of lines: 0
Number of boundaries: 17948
Number of centroids: 0
Number of areas: 11949
Number of isles: 1
Number of areas without centroid: 11949
100%
Building topology for vector map <test2>...
Attaching islands...
100%
Attaching centroids...
100%
Number of nodes: 17949
Number of primitives: 29897
Number of points: 0
Number of lines: 0
Number of boundaries: 17948
Number of centroids: 11949
Number of areas: 11949
Number of isles: 1
'vector/elev_lid792_randpts' was found in more mapsets (also found in
<user1>)Using <elev_lid792_randpts@PERMANENT>Debug: Off
Modified Time: 254
Reference Count: 1
Registered Events: (none)
Is Open: True:
Organisation: NC OneMap
CreationDate:
Person: hmitaso
Title: Rural area (in tile 792), random points from lidar-based DEM
FullName: elev_lid792_randpts@PERMANENT
Mapset: PERMANENT
MapDate: Mon Mar 19 00:37:45 2007
Scale: 1
Comment:
Zone: 0
Threshold: 0
Projection: 99
ProjectionName: Lambert Conformal Conic
Is 3d: No
Total number of coor points: 6000