Discussion:
[vtkusers] Delaunay surface triangulation in 3D
Doug Hackworth
2008-10-17 14:39:35 UTC
Permalink
Greetings. I have a set of N points that reside on the surface of a
sphere, and I'd like to create a triangular (not tetrahedral) mesh
between these points via Delaunay triangulation. Using vtkDelaunay2D is
out because it does a different thing (ignoring the Z-coordinate during
its triangulation). And using vtkDelaunay3D only does part of the right
thing -- it appears to triangulate the surface points nicely, but also
creates (as its primary function) a tetrahedral mesh among all the
points in 3 dimensions.

How can I get a triangulated surface? Just to be clear on what I want,
the end result should be a hollow volume of triangles, rather like a
geodesic dome. That make sense?

It seems as if using vtkDelaunay3D and then extracting the surface
triangles only could be a promising course of action, but I have no idea
how to do this (I'm also not sure that it's guaranteed to produce the
right result). Can someone offer some guidance on this? Is there an
alternative method that would be better? Please, offer me your wisdom. :-)

Thanks,
Doug
Bill Lorensen
2008-10-17 16:21:36 UTC
Permalink
vtkGeometryFilter will extract surface cells from a volumetric mesh.

On Fri, Oct 17, 2008 at 10:39 AM, Doug Hackworth
Greetings. I have a set of N points that reside on the surface of a sphere,
and I'd like to create a triangular (not tetrahedral) mesh between these
points via Delaunay triangulation. Using vtkDelaunay2D is out because it
does a different thing (ignoring the Z-coordinate during its triangulation).
And using vtkDelaunay3D only does part of the right thing -- it appears to
triangulate the surface points nicely, but also creates (as its primary
function) a tetrahedral mesh among all the points in 3 dimensions.
How can I get a triangulated surface? Just to be clear on what I want, the
end result should be a hollow volume of triangles, rather like a geodesic
dome. That make sense?
It seems as if using vtkDelaunay3D and then extracting the surface triangles
only could be a promising course of action, but I have no idea how to do
this (I'm also not sure that it's guaranteed to produce the right result).
Can someone offer some guidance on this? Is there an alternative method
that would be better? Please, offer me your wisdom. :-)
Thanks,
Doug
_______________________________________________
This is the private VTK discussion list.
http://www.vtk.org/Wiki/VTK_FAQ
http://www.vtk.org/mailman/listinfo/vtkusers
Björn Zehner
2008-10-17 16:34:16 UTC
Permalink
Matthias Riechmann
2008-10-17 19:38:30 UTC
Permalink
Hi Doug,

as far as I remember using vtk's delaunay, you have to think two
dimensional even if its a three dimensional set of points that you want
to form a surface: You can specify a transform to the vtkDelaunay2D
filter, so if you have a bunch of points forming more or less a sphere,
you just have to give the filter a vtkSphericalTransform. Then it can
assemble the surface from the phi and theta coordinates ignoring r. Of
course you have to transform the points in a way so their center is in
the neighbourhood of (0, 0, 0).

For more details see the documentation of vtkDelaunay2D.


Matthias
Post by Doug Hackworth
Greetings. I have a set of N points that reside on the surface of a
sphere, and I'd like to create a triangular (not tetrahedral) mesh
between these points via Delaunay triangulation. Using vtkDelaunay2D is
out because it does a different thing (ignoring the Z-coordinate during
its triangulation). And using vtkDelaunay3D only does part of the right
thing -- it appears to triangulate the surface points nicely, but also
creates (as its primary function) a tetrahedral mesh among all the
points in 3 dimensions.
How can I get a triangulated surface? Just to be clear on what I want,
the end result should be a hollow volume of triangles, rather like a
geodesic dome. That make sense?
It seems as if using vtkDelaunay3D and then extracting the surface
triangles only could be a promising course of action, but I have no idea
how to do this (I'm also not sure that it's guaranteed to produce the
right result). Can someone offer some guidance on this? Is there an
alternative method that would be better? Please, offer me your wisdom.
:-)
Thanks,
Doug
_______________________________________________
This is the private VTK discussion list.
http://www.vtk.org/Wiki/VTK_FAQ
http://www.vtk.org/mailman/listinfo/vtkusers
Doug Hackworth
2008-10-17 20:42:41 UTC
Permalink
Thanks to everyone who's replied so far. I'm getting on the right
Post by Bill Lorensen
vtkGeometryFilter will extract surface cells from a volumetric mesh.
The documentation for vtkGeometryFilter certainly makes this sound
promising ("All 2D faces that are used by only one 3D cell (i.e.,
boundary faces) are extracted") , but it's not clear to me how to
actually accomplish this. The methods presented in the class
documentation don't make a lot of sense to me, and the examples from
Kitware (ExtractUGrid.py and pointToCellData.py) don't make it obvious
to me, either.

I'm imagining something of this sort:

vtkGeometryFilter* geom = vtkGeometryFilter::New();
geom->SetInput(somePolyData);
geom->SomeOtherMethods();
geom->Update();

I'm just not seeing at the moment what SomeOtherMethods() might be...
Can someone explain this, and/or offer some sample code?
Post by Bill Lorensen
I never tried it, but vtkSurfaceReconstructionFilter might be one way,
but be a little bit of overkill if it is a convex shape like a normal
sphere ......
This also sounds promising, since although I'm just working with spheres
now I will ultimately want to triangulate more complex surfaces which
may or may not be describable by a mathematical function. Here again,
though, I have much the same issue as with vtkGeometryFilter above. Can
anyone enlighten me?

Many thanks for your help.

Kindest regards,
Doug
Post by Bill Lorensen
Post by Doug Hackworth
Greetings. I have a set of N points that reside on the surface of a
sphere, and I'd like to create a triangular (not tetrahedral) mesh
between these points via Delaunay triangulation. Using vtkDelaunay2D
is out because it does a different thing (ignoring the Z-coordinate
during its triangulation). And using vtkDelaunay3D only does part of
the right thing -- it appears to triangulate the surface points
nicely, but also creates (as its primary function) a tetrahedral mesh
among all the points in 3 dimensions.
How can I get a triangulated surface? Just to be clear on what I
want, the end result should be a hollow volume of triangles, rather
like a geodesic dome. That make sense?
It seems as if using vtkDelaunay3D and then extracting the surface
triangles only could be a promising course of action, but I have no
idea how to do this (I'm also not sure that it's guaranteed to produce
the right result). Can someone offer some guidance on this? Is there
an alternative method that would be better? Please, offer me your
wisdom. :-)
Thanks,
Doug
Bill Lorensen
2008-10-17 20:58:19 UTC
Permalink
Just run GeometryFilter without "SomeOtherMethod". I thing the default
behaviour is wnat you want.

On Fri, Oct 17, 2008 at 4:42 PM, Doug Hackworth
Thanks to everyone who's replied so far. I'm getting on the right track, I
Post by Bill Lorensen
vtkGeometryFilter will extract surface cells from a volumetric mesh.
The documentation for vtkGeometryFilter certainly makes this sound promising
("All 2D faces that are used by only one 3D cell (i.e., boundary faces) are
extracted") , but it's not clear to me how to actually accomplish this. The
methods presented in the class documentation don't make a lot of sense to
me, and the examples from Kitware (ExtractUGrid.py and pointToCellData.py)
don't make it obvious to me, either.
vtkGeometryFilter* geom = vtkGeometryFilter::New();
geom->SetInput(somePolyData);
geom->SomeOtherMethods();
geom->Update();
I'm just not seeing at the moment what SomeOtherMethods() might be... Can
someone explain this, and/or offer some sample code?
Post by Bill Lorensen
I never tried it, but vtkSurfaceReconstructionFilter might be one way,
but be a little bit of overkill if it is a convex shape like a normal
sphere ......
This also sounds promising, since although I'm just working with spheres now
I will ultimately want to triangulate more complex surfaces which may or may
not be describable by a mathematical function. Here again, though, I have
much the same issue as with vtkGeometryFilter above. Can anyone enlighten
me?
Many thanks for your help.
Kindest regards,
Doug
Post by Bill Lorensen
Post by Doug Hackworth
Greetings. I have a set of N points that reside on the surface of a
sphere, and I'd like to create a triangular (not tetrahedral) mesh between
these points via Delaunay triangulation. Using vtkDelaunay2D is out because
it does a different thing (ignoring the Z-coordinate during its
triangulation). And using vtkDelaunay3D only does part of the right thing
-- it appears to triangulate the surface points nicely, but also creates (as
its primary function) a tetrahedral mesh among all the points in 3
dimensions.
How can I get a triangulated surface? Just to be clear on what I want,
the end result should be a hollow volume of triangles, rather like a
geodesic dome. That make sense?
It seems as if using vtkDelaunay3D and then extracting the surface
triangles only could be a promising course of action, but I have no idea how
to do this (I'm also not sure that it's guaranteed to produce the right
result). Can someone offer some guidance on this? Is there an alternative
method that would be better? Please, offer me your wisdom. :-)
Thanks,
Doug
_______________________________________________
This is the private VTK discussion list.
http://www.vtk.org/Wiki/VTK_FAQ
http://www.vtk.org/mailman/listinfo/vtkusers
Doug Hackworth
2008-10-17 21:10:13 UTC
Permalink
Post by Bill Lorensen
Just run GeometryFilter without "SomeOtherMethod". I thing the default
behaviour is wnat you want.
Hmmm. Well, it's not working for me that way, but perhaps I'm missing
something. Here's my code, from the 3D Delaunay operation on down:

// Do surface triangulation
vtkDelaunay3D* delny = vtkDelaunay3D::New();
delny->SetInput(pPolyData);
delny->SetTolerance(0.001);
delny->Update();

// Store Delaunay output as PolyData
vtkUnstructuredGrid* usg = vtkUnstructuredGrid::New();
usg = delny->GetOutput();
vtkPolyData* pd = vtkPolyData::New();
pd->SetPoints(usg->GetPoints());
pd->SetPolys(usg->GetCells());

// Get surface triangles with geometry filter
vtkGeometryFilter* geom = vtkGeometryFilter::New();
geom->SetInput(pd);
geom->Update();

// Write the surface triangles to file as PolyData
vtkPolyDataWriter* pWriter = vtkPolyDataWriter::New();
pWriter->SetFileName(szOutfile.c_str());
pWriter->SetInput(geom->GetOutput());
pWriter->Write();

...The PolyData file that comes out this end still has all the
tetrahedrons intact (and nothing else). Perhaps there's a mistake here
that I'm just not seeing...?

Thanks,
Doug
Magnotta, Vincent A
2008-10-17 21:15:54 UTC
Permalink
I believe that you want

vtkGeometryFilter* geom = vtkGeometryFilter::New();
geom->SetInput( delny->GetOutput() );
geom->Update();


Vince

----------------------
Associate Professor
Department of Radiology
0453-D JCP
200 Hawkins Drive
Iowa City, IA 52242
E-mail: vincent-***@uiowa.edu
Phone: 319-356-8255 Fax: 319-353-6275
Website: http://www.radiology.uiowa.edu



-----Original Message-----
From: vtkusers-***@vtk.org on behalf of Doug Hackworth
Sent: Fri 10/17/2008 4:10 PM
To: ***@vtk.org
Subject: Re: [vtkusers] Delaunay surface triangulation in 3D
Post by Bill Lorensen
Just run GeometryFilter without "SomeOtherMethod". I thing the default
behaviour is wnat you want.
Hmmm. Well, it's not working for me that way, but perhaps I'm missing
something. Here's my code, from the 3D Delaunay operation on down:

// Do surface triangulation
vtkDelaunay3D* delny = vtkDelaunay3D::New();
delny->SetInput(pPolyData);
delny->SetTolerance(0.001);
delny->Update();

// Store Delaunay output as PolyData
vtkUnstructuredGrid* usg = vtkUnstructuredGrid::New();
usg = delny->GetOutput();
vtkPolyData* pd = vtkPolyData::New();
pd->SetPoints(usg->GetPoints());
pd->SetPolys(usg->GetCells());

// Get surface triangles with geometry filter
vtkGeometryFilter* geom = vtkGeometryFilter::New();
geom->SetInput(pd);
geom->Update();

// Write the surface triangles to file as PolyData
vtkPolyDataWriter* pWriter = vtkPolyDataWriter::New();
pWriter->SetFileName(szOutfile.c_str());
pWriter->SetInput(geom->GetOutput());
pWriter->Write();

...The PolyData file that comes out this end still has all the
tetrahedrons intact (and nothing else). Perhaps there's a mistake here
that I'm just not seeing...?

Thanks,
Doug
Doug Hackworth
2008-10-17 21:30:23 UTC
Permalink
Post by Magnotta, Vincent A
I believe that you want
vtkGeometryFilter* geom = vtkGeometryFilter::New();
geom->SetInput( delny->GetOutput() );
geom->Update();
Aha! That did it! Exactly what I was needing -- thanks!

Just for my edification, why did this work when my first method did not?
According to the documentation, SetInput() takes a vtkDataObject* .
GetOutput() returns a vtkUnstructuredGrid*, which is legal since
vtkUnstructuredGrid is derived from vtkDataObject -- but then why didn't
passing in a pointer to a vtkPolyData (also derived from vtkDataObject)
do the same thing? I suppose it must have been something about the way
I was "coercing" an unstructured grid into a PolyData, but what?

Many thanks, everyone.

Loading...