[vtkusers] Is it possible to keep the original Ids for picking after vtkClipPolyData?

Hong Yi hongyi at renci.org
Mon May 2 11:23:32 EDT 2011


I made a small sample of code that demonstrates the problem for picking after ClipPolyData. See attached cpp file. Although it does not follow the more complicated workflow in my application, I believe it demonstrates the same problem exhibited in my application.

You can see the problem by following the steps below:

1. Zoom out the view and then rotate the view and move the clipping plane until it clips away some part of the data. An example snapshot is shown in the attached jpg. In the snapshot, the mouse-clicked location for picking is actually one sphere above the sphere with a tessellated triangle cell being highlighted in red, due to the Id changes caused by ClipPolyData. You can also see different cell id output from console window for the same picked location between when there are data being clipped away and when no clipping occurs.
2. If you move the clip plane away so no data is clipped, then the highlighted picked cell reflects the cell being picked by the mouse, but if some data is clipped away, then most likely the highlighted picked cell will be off from the true picked cell by some amount depending on where you mouse-click on the data.

Let me know if you need more info from me.

Thanks,

Hong

-----Original Message-----
From: David E DeMarle [mailto:dave.demarle at kitware.com] 
Sent: Friday, April 29, 2011 4:54 PM
To: David Gobbi
Cc: Hong Yi; VTK Users
Subject: Re: [vtkusers] Is it possible to keep the original Ids for picking after vtkClipPolyData?

And it also sounds like a bug.

Filters that don't know how to trace ancestry across should remove the ID array, not recompute it.
The rationale is that is alright to produce an "I don't know" answer, but not alright to produce an incorrect answer.

Can you post a small sample of code which demonstrates the problem?

David E DeMarle
Kitware, Inc.
R&D Engineer
28 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-371-3971 x109



On Fri, Apr 29, 2011 at 4:40 PM, David Gobbi <david.gobbi at gmail.com> wrote:
> Hi Hong,

> You can avoid this problem by using the mapper to clip the data, via 
> the vtkMapper::AddClippingPlane() method, instead of using 
> vtkClipPolyData.
>
>  - David
>
>
> On Fri, Apr 29, 2011 at 2:33 PM, Hong Yi <hongyi at renci.org> wrote:
>> Hello,
>>
>>
>>
>> I am using vtkClipPolyData to clip polydata geometry in combination 
>> with vtkImplicitPlaneWidget2. It works well but apparently after 
>> clipping, the original Ids corresponding to each point (in my case, 
>> an atom) in polydata geometry is recomputed. Since I am using the 
>> original Ids for picking and highlighting the corresponding residues 
>> in another view window, after clipping, the picking and highlighting 
>> does not pick the right atom and residue because the Ids are changed 
>> after clipping. Is there a way to keep the original Ids after clipping?
>>
>>
>>
>> Thanks for any pointers on this,
>>
>>
>>
>> Hong
> _______________________________________________
> 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 embedded and charset-unspecified text was scrubbed...
Name: CellPickingWithClipPolyData.cpp
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110502/5f024129/attachment.asc>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clipdemo.jpg
Type: image/jpeg
Size: 47573 bytes
Desc: clipdemo.jpg
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110502/5f024129/attachment.jpg>


More information about the vtkusers mailing list