[vtkusers] slice structured grid with polydata
Cory Quammen
cory.quammen at kitware.com
Thu Feb 18 22:58:16 EST 2016
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160218/14f11fd2/attachment.html>
More information about the vtkusers
mailing list