[vtkusers] Questions on Boolean Ops & vtkPolyData merging

David.Pont at ForestResearch.co.nz David.Pont at ForestResearch.co.nz
Wed Oct 20 16:11:11 EDT 2004





Hi Jim,

normand at lina.univ-nantes.fr wrote on 21/10/2004 00:02:17:

> Hi all!
>
> I am new to VTK, and  I'm trying to use vtk to perform boolean
> operations on polyData, it seems to be possible by using
> vtkImplicitDataSet but I haven't been able to use it properly and I
> haven't found many examples of it.
>
> I've searched in the archives of the mailing list and I saw that David
> Pont had written a vtkImplicitPolyData class that could handle what I'd
> like to do. I would be very glad if he (or someone else ;) could provide
> me the code of this class and even better some examples on how to use
> it.
>
I will send you the source code for vtkImplicitPolyData (off the list to
avoid unecessary traffic). It is a bit of a hack, usually does what is
expected, someday I might find time to develop it a bit further...

> Moreover since I failed using vtkImplicitDataSet, I tested the boolean
> ops on some ImplicitFunctions, which worked very well, but I have a
> question about the visualization of the resulting surfaces. Once I get
> the implicit boolean, I declare a vtkSampleFunction which I think (but I
> may be wrong) represent the distance function of the implicit function
> nd afterwards I need a vtkContourFilter which will represent the
> polgonal surface (I still may be wrong).
>
> My question is what does the vtkContourFilter::SetValue actually do, I
> don't really understand what does the 2nd parameter represent, I know
> this question may seems dumb but I'm not used working on Implicit
> Functions, I usually work on volumic surfaces and polygonal datas.
>
vtkSampleFunction evaluates an implicit function (or boolean combination)
over a regular 3D grid to give 'volume' type data. vtkContourFilter then
produces a surface at the given function value (SetValue). It interpolates
between point values and triangulates within the cubical cells of the grid.
I think I am right in saying this means you can also get a surface using
the vtkMarchingCubes filter(s). Hope that is clear.
Note that this is quite a brute force approach, the function is evaluated
at many positions, then just a few values are used to derive the surface.
The advantage is that multiple surfaces at different function values can be
generated, and this approach fits with the vtk philosophy of generality and
makes connection with many other vtk filters possible as 3D grid data is
well supported in vtk.
If you are interested I do have source code for an adaptive polygonizer
which takes an implicit function and produces a surface directly, ie
without generating a 3D grid first. There are tradeoffs between the two
approaches, to sum it up the adaptive approach can run in a similar time,
and can give a better surface...

>
> I also wonder if it is possible to merge the geometry/topology of 2
> vtkPolyData objects, I saw the vtkMergeFilter in the doc, but it seems
> that you could only merge the geometry of one DataSet with the Scalars
> or normals of antoher, but not with the geometry. I again may be wrong
> since I'm really new to VTK.
>
vtkAppendPolyData will lump two polydata sets together, it simply copies
all points and cells into a single dataset. Scalars, vectors and normals
are also copied if present in both datasets. This is a handy filter when
working with boolean operations.

  regards
      Dave Pont

> I could provide further information if my questions are not clear
> enough, any help would be greatly appreciated.
> Thanks in advance.
>
> Jim
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: <http://public.
> kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers




More information about the vtkusers mailing list