[vtkusers] Fill in 2D vtkPolyData

Jonathan Morra jonmorra at gmail.com
Wed Apr 25 00:38:32 EDT 2012


I've been looking at this all day, and I think the answer lies within
the vtkCTPFCheckPolygonSense method.  It would appear that for complex
drawings which are correctly filled in, this method returns a sense of 1
for all but the outer contour and incorrectly filled in contours return a
sense of 0 for all but the outer contour.  Before I continue down this
road, I was wondering if there might be a more straightforward way to solve
my problem.

I have a 3D binary volume from which I am extracting a contour for
visualization using vtkMarchingSquares and a 2D region.  I want to
visualize the interior of this contour with varying levels of opacity.  Is
there another way to do this other than
1.  Use vtkMarchingSquares to vtkStripper to generate a 2D mesh
2.  Run 2D mesh through vtkContourToPolygonFilter
3.  Visualize

Is there someway to just tell vtkMarchingSquares to fill in the output, or
maybe something else I haven't thought of?

On Mon, Apr 23, 2012 at 9:20 AM, Jonathan Morra <jonmorra at gmail.com> wrote:

> I'm just getting around to looking into this now.  I'll let you know if I
> fix this for my case.  On a related note, does there exist a filter which
> takes as input a specified 2D vtkPolyData, and a set of candidate 2D
> vtkPolyDatas, and returns a list of those candidate vtkPolyDatas which are
> wholly inside the specified input?  This seems to be related to this filter.
>
>
> On Thu, Apr 19, 2012 at 11:03 AM, David Gobbi <david.gobbi at gmail.com>wrote:
>
>> Hi Jonathan,
>>
>> This is why I haven't added this filter to VTK yet.  When the input
>> has multiple contours, the code doesn't yet have the necessary logic
>> for determining which contours are holes.  In your case, it has
>> incorrectly marked the large contour as a hole.
>>
>> Unfortunately I cannot provide you with a timeline for when I will
>> finish this filter, lately I've been crazy busy on other projects.
>> But if you want to give it a shot yourself, take a look at the code
>> for vtkContourToPolygonFilter::MakePolysFromContours(). The
>> section that needs to be modified is the block that starts with
>> "if (normal == 0)".
>>
>>  - David
>>
>>
>> On Thu, Apr 19, 2012 at 11:44 AM, Jonathan Morra <jonmorra at gmail.com>
>> wrote:
>> >
>> > After using your filter for a little while, for the most part it works
>> great, however I have discovered a few cases where it doesn't work.  I've
>> attached a screen shot showing a failure,  The first image is the input
>> vtkPolyData, and the second is the result of running through your filter.
>>  Can you determine what is going on?  If not, I'd be happy to give you the
>> poly data I'm using, just let me know how to export it to disk, and I can
>> email it to you.
>> >
>> > Thanks
>> >
>> > PS The behavior seems unpredictable, as sometimes with shapes just as
>> complicated it works fine, I can't seem to tell what makes it fail.
>> >
>> >
>> >
>> >
>> >
>> >
>> > On Tue, Apr 10, 2012 at 12:26 PM, David Gobbi <david.gobbi at gmail.com>
>> wrote:
>> >>
>> >> Use the PickableOff() method (on the actor, not the data).
>> >>
>> >> On Tue, Apr 10, 2012 at 1:17 PM, Jonathan Morra <jonmorra at gmail.com>
>> wrote:
>> >> > One more question along this same line.  Now that I have opaque
>> vtkPolyData,
>> >> > I'm noticing that my vtkPicker is no longer hitting the same data it
>> was
>> >> > before, it's hitting the now opaque poly data.  This makes sense to
>> me, but
>> >> > I don't want it to happen.  Is there a way to tell the vtkPicker to
>> ignore
>> >> > some vtkPolyData (ie always pick the underlying data).
>> >> >
>> >> > Thanks
>> >
>> >
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120424/22f6e1ce/attachment.htm>


More information about the vtkusers mailing list