[vtkusers] Merging two Unstructured Grids / Surfaces

Eric E. Monson emonson at cs.duke.edu
Tue Mar 2 13:31:15 EST 2010


Well, this isn't perfect, but here's a slightly modified example (sorry, this time in python) which clips the sphere with the cube. You need _some_ scalars associated with the geometry used for the implicit function, and the evaluation of what is inside and what is outside the shape only really works if the shape used for the implicit function has 3D cells (not just polygonal cells on the surface), so I used vtkDelaunay3D to create these cells in the cube. This might not work well if the shape you're clipping with isn't convex...

http://www.vtk.org/Wiki/VTK/Examples/Python/vtkImplicitDataSet

You can see from the screen shot there that cells on the sphere aren't split by the clip.

Hope this gets you a little further. It still may be worth checking out GTS for real boolean operations if someone else doesn't have a cleaner way of doing the same within VTK.

-Eric


On Mar 1, 2010, at 6:38 PM, David Doria wrote:

> On Mon, Mar 1, 2010 at 4:56 PM, Eric E. Monson <emonson at cs.duke.edu> wrote:
> Hey Karl,
> 
> I'm sure others will have more ideas, but regarding combining input grids, there was a thread last July in which people were talking about using the GNU Triangulated Surface Library to do boolean operations on surfaces:
> 
> http://www.vtk.org/pipermail/vtkusers/2009-July/101865.html
> 
> You have to convert back and forth between the VTK and GTS data structures, but I have played around with it a bit and it works well. (There is also some partial wrapping of the GTS in python if this is useful.)
> 
> And, looking through the VTK classes, there is a vtkImplicitDataSet (with a couple of Tcl tests as examples to show how to use it), which maybe could help with the clipping you are talking about. This is where others should know more than I.
> 
> http://www.vtk.org/doc/nightly/html/classvtkImplicitDataSet.html
> 
> Talk to you later,
> -Eric
> 
> ------------------------------------------------------
> Eric E Monson
> Duke Visualization Technology Group
> 
> 
> On Mar 1, 2010, at 4:29 PM, Karl Heinrichmeyer wrote:
> 
> > Hi together ..
> >
> > I'm working at a project that uses Vtk to prepare intermediate results of different numeric simulations, all part of the engineering sciences, for the next simulation step. The data to work with are in general unstructured grids representing the geometry and properties of working-pieces while the simulations are something like welding and forging.
> >
> > For one of this simulations i need to combine two input grids, that represent two working-peaces prepared for welding,  into one single surface. The two working peaces, in the actual case a gear-wheel and a ring, "lie on each other". That means the grids have contact and may intersect a little bit. The input consists of unstructured grids. The output has to be the combined surface of both grids without the contact surface. The mesh of this output surface isn't important while the shape has to match the input exact as possible.
> >
> > I tried several things on my own and my current plan to proceed is the following:
> >
> > 1. Extract the surfaces of both geometries using vtkDataSetSurfaceFilter
> > 2. Clipping the resulting polydata with each other using vtkClipPolyData
> > 3. Extracting the cutting edge with vtkFeaturedEdges
> > 4. "sewing" the edges by hand with an own algorithm
> > 5. put everything together.
> >
> > My first question is: Has anybody a better idea to do this? And maybe: Is this possible at all?  I searched the vtk documentation quite a long time without results.
> >
> > The second problem i found is to clip the surfaces with each other. I would need something like a vtkImplicitPolyData. I searched for something like this too but the only thing i found was a thread from 2001. Is there something like an vtkImplicitPolyData in vtk that takes a polygonal surface and behave like an implicit function that can be used for clipping?
> >
> > Thanks in advance.
> >
> > Karl
> 
> 
> To the problem about clipping one object with another, using the classes mentioned I tried to do this: 
> http://www.vtk.org/Wiki/VTK/Examples/ImplicitDataSet
> 
> But it complains "Can't evaluate dataset!". The documentation says you must have scalars - maybe you can figure out what they need to be?
> 
> Thanks,
> 
> David 
> 
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100302/a3033c2b/attachment.htm>


More information about the vtkusers mailing list