[vtkusers] Mesh cutting using freehand curve

Goodwin Lawlor goodwin.lawlor.lists at gmail.com
Tue May 22 12:50:21 EDT 2012


Hi Miguel,

vtkSelectPolyData requires an almost closed loop - it closes the last and
first point for you.

>From your picture below, you'll need to extend your points to the edge of
the model on both sides.

hth

Goodwin

On Tue, May 22, 2012 at 1:38 PM, Miguel Sotaquira <msotaquira at gmail.com>wrote:

> Hi Goodwin,
>
> The filter vtkSelectPolyData doesn't require a closed loop to select the
> region inside/outside the polygonal mesh? In my case I actually don't have
> a closed contour, just a freehand line obtained using vtkContourWidget.
>
> I was checking the documentation and there's this vtkImplicitSelectionLoop
> that would be useful, although - again - it seems that only works with
> closed contours. Isn't there something similar to vtkImplicitSelectionLoop
> but that works with open selections?
>
> Thanks again!
> Miguel
>
>
> On Tue, May 22, 2012 at 8:16 AM, Goodwin Lawlor <
> goodwin.lawlor.lists at gmail.com> wrote:
>
>> Hi Miguel,
>>
>> Try out this pipeline:
>> (in Tcl but it's the same idea in any language)
>>
>>   vtkPoints selectionPoints
>>     selectionPoints InsertNextPoint 1.0 1.0 1.0
>> # etc...
>>
>>   vtkSelectPolyData select
>>     select SetLoop selectionPoints
>> # connect your data here
>>     select SetInputConnection [mydataFilter GetOutputPort]
>>     select GenerateSelectionScalarsOn
>>     select SetSelectionModeToLargestRegion;
>>
>>   vtkClipPolyData selectclip
>>     selectclip SetInputConnection [select GetOutputPort]
>>     selectclip SetValue 0.0
>>
>> It's not 100% robust but works for most meshes that have well behaved
>> topology...
>>
>> hth
>>
>> Goodwin
>>
>> On Tue, May 22, 2012 at 4:45 AM, Miguel Sotaquira <msotaquira at gmail.com>wrote:
>>
>>> Hi everyone!
>>>
>>> I have a 3D manifold mesh and I want to be able to cut it using a
>>> freehand (drawn by user) contour. An example of such a mesh and the contour
>>> drawn by the user is shown in this image:
>>> http://postimage.org/image/sbnmcoodj/. By cutting I mean generating a
>>> 3D surface from the freehand contour and then splitting the mesh in two
>>> parts.
>>>
>>> Up to this point I've came up with this workflow for generating the
>>> freehand contour: vtkContourWidget -> vtkPolygonalSurfacePointPlacer. With
>>> this approach I'm able to draw the contour on the polydata mesh (see
>>> previous figure) and extract the set of contour point coordinates.
>>>
>>> However I'm lost from this point:
>>> - How to generate the 3D cutting surface?
>>> - Which would be the most adequate class to perform the cutting:
>>> vtkClipPolyData, vtkCutter, vtkExtractPolyDataGeometry?
>>> - In any of the previous classes I need a vtkImplicitFunction. How to
>>> define a vtkImplicitFunction using the 3D cutting surface?
>>>
>>> Thanks for any suggestions,
>>> Miguel
>>>
>>> _______________________________________________
>>> 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/20120522/66729b72/attachment.htm>


More information about the vtkusers mailing list