[vtkusers] slice structured grid with polydata

Justin Weber onlyjus at gmail.com
Thu Mar 24 14:21:07 EDT 2016


It would be nice if the grid was not tetrahedralized first. I would like
the original hexahedrons that are not sliced to be preserved.

On Thu, Mar 24, 2016 at 11:59 AM, Cory Quammen <cory.quammen at kitware.com>
wrote:

> What do you want as output instead?
>
> On Thu, Mar 24, 2016 at 10:53 AM, Justin Weber <onlyjus at gmail.com> wrote:
> > I didn't realize this earlier but the vtkClipDataSet tetrahedralizes the
> > mesh before slicing? It seems that this is required for the algorithm. Do
> > you know of any ways to prevent this?
> >
> > BTW, here is the link to the example:
> >
> http://www.vtk.org/Wiki/VTK/Examples/Python/Meshes/vtkClipDataSetWithPolydata
> >
> > Justin
> >
> > On Mon, Mar 7, 2016 at 5:30 PM, Cory Quammen <cory.quammen at kitware.com>
> > wrote:
> >>
> >> That's great, Justin. Thanks for reporting back.
> >>
> >> Cory
> >>
> >> On Mon, Mar 7, 2016 at 4:04 PM, Justin Weber <onlyjus at gmail.com> wrote:
> >>>
> >>> Cory,
> >>>
> >>> Thanks for your help. I got it working! I might put the code up as an
> >>> example.
> >>>
> >>>
> >>> Justin
> >>>
> >>> On Thu, Feb 18, 2016 at 10:58 PM, Cory Quammen <
> cory.quammen at kitware.com>
> >>> wrote:
> >>>>
> >>>> Justin,
> >>>>
> >>>> There is nothing canned in VTK to do this, but with some work you
> should
> >>>> be able to get there using an implicit function created from your STL
> file.
> >>>> At a high level, what you would do is create an instance of
> >>>> vtkImplicitPolyDataDistance. Set its input to the poly data from the
> STL
> >>>> file. Then, create a new point data array in your structured grid that
> >>>> stores the value from the implicit poly data distance filter. Negative
> >>>> values will be inside the poly data, positive values outside, and 0
> at the
> >>>> surface. Finally, use vtkClipDataSet to clip the structured grid a
> function
> >>>> value 0. This should give you back an unstructured grid in
> approximately the
> >>>> shape of your input STL. It won't be exact because of the
> interpolation used
> >>>> by vtkClipDataSet, but it should be close.
> >>>>
> >>>> Hope that helps.
> >>>>
> >>>> Cory
> >>>>
> >>>> On Thu, Feb 18, 2016 at 10:08 PM, Justin Weber <onlyjus at gmail.com>
> >>>> wrote:
> >>>>>
> >>>>> I would like to generate a "cutcell" mesh using vtk by slicing a
> >>>>> structured grid with polydata loaded from a STL file. The resulting
> mesh
> >>>>> would be an unstructured grid.
> >>>>>
> >>>>> Are there any tools in vtk to accomplish this?
> >>>>>
> >>>>> I can create the structured grid and polydata successfully. Now I
> just
> >>>>> need an algorithm to slice the structured mesh with the polydata
> surface.
> >>>>>
> >>>>> In my searching I could not find anything. However, I could
> accomplish
> >>>>> this by ray casting to find the intersections between the structured
> grid
> >>>>> and the polydata. Then using those points to create the unstructured
> grid.
> >>>>>
> >>>>> See attached 2d sketch.
> >>>>>
> >>>>> Thanks!
> >>>>> Justin
> >>>>>
> >>>>>
> >>>>> _______________________________________________
> >>>>> 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
> >>>>>
> >>>>> Search the list archives at: http://markmail.org/search/?q=vtkusers
> >>>>>
> >>>>> Follow this link to subscribe/unsubscribe:
> >>>>> http://public.kitware.com/mailman/listinfo/vtkusers
> >>>>>
> >>>>
> >>>>
> >>>>
> >>>> --
> >>>> Cory Quammen
> >>>> R&D Engineer
> >>>> Kitware, Inc.
> >>>
> >>>
> >>
> >>
> >>
> >> --
> >> Cory Quammen
> >> R&D Engineer
> >> Kitware, Inc.
> >
> >
>
>
>
> --
> Cory Quammen
> R&D Engineer
> Kitware, Inc.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160324/ea85f9a8/attachment.html>


More information about the vtkusers mailing list