<div dir="ltr">Justin,<div><br></div><div>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.</div><div><br></div><div>Hope that helps.</div><div><br></div><div>Cory</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Feb 18, 2016 at 10:08 PM, Justin Weber <span dir="ltr"><<a href="mailto:onlyjus@gmail.com" target="_blank">onlyjus@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">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.</p>
<p dir="ltr">Are there any tools in vtk to accomplish this?</p>
<p dir="ltr">I can create the structured grid and polydata successfully. Now I just need an algorithm to slice the structured mesh with the polydata surface.</p>
<p dir="ltr">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.</p>
<p dir="ltr">See attached 2d sketch.</p>
<p dir="ltr">Thanks!<span class="HOEnZb"><font color="#888888"><br>
Justin</font></span></p>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Cory Quammen<br>R&D Engineer<br>Kitware, Inc.</div>
</div>