<div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">Here is a simple example to illustrate the issue, with screenshots of different situations:</span><div style="font-family:arial,sans-serif;font-size:13px">
<br></div><div style="font-family:arial,sans-serif;font-size:13px">clip.jpg: the mapper is clipped, the actor has no transformation</div><div style="font-family:arial,sans-serif;font-size:13px">transform.jpg: the mapper is not clipped, the actor has a transformation</div>
<div style="font-family:arial,sans-serif;font-size:13px"><div>cliptransform.jpg: the mapper is clipped, the actor has a transformation  ==&gt; the actor is culled</div><div><br></div></div><div style="font-family:arial,sans-serif;font-size:13px">
<div>#include &lt;vtkActor.h&gt;</div><div>#include &lt;vtkAxesActor.h&gt;</div><div>#include &lt;vtkPolyDataMapper.h&gt;<br></div><div>#include &lt;vtkRenderer.h&gt;<br></div><div>#include &lt;vtkRenderWindow.h&gt;</div>
<div>#include &lt;vtkRenderWindowInteractor.h&gt;</div><div>#include &lt;vtkSmartPointer.h&gt;</div><div>#include &lt;vtkSphereSource.h&gt;</div><div>#include &lt;vtkPlanes.h&gt;</div><div>#include &lt;vtkTransform.h&gt;<br>
</div></div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px"><div>   vtkSmartPointer&lt;vtkRenderer&gt; ren1= vtkSmartPointer&lt;vtkRenderer&gt;::New();<br>
</div><div>   ren1-&gt;SetBackground(0.4, 0.4, 0.5);</div><div>   ren1-&gt;SetBackground2(0.2,0.2,0.3);</div><div>   ren1-&gt;SetGradientBackground(true);</div><div><br></div><div>   vtkSmartPointer&lt;vtkRenderWindow&gt; renWin= vtkSmartPointer&lt;vtkRenderWindow&gt;::New();<br>
</div><div>   renWin-&gt;SetSize( 972, 800 );</div><div>   renWin-&gt;AddRenderer(ren1);</div><div><br></div><div>   vtkSmartPointer&lt;vtkRenderWindowInteractor&gt; iren= vtkSmartPointer&lt;vtkRenderWindowInteractor&gt;::New();<br>
</div><div>   iren-&gt;SetRenderWindow(renWin);</div></div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px"><div>   vtkSmartPointer&lt;vtkSphereSource&gt; sph= vtkSmartPointer&lt;vtkSphereSource&gt;::New();<br>
</div><div>   sph-&gt;SetPhiResolution(22);</div><div>   sph-&gt;SetThetaResolution(22);</div><div>   sph-&gt;SetRadius(2.0);</div><div>   sph-&gt;Update();</div><div><br></div><div>   vtkSmartPointer&lt;vtkPlanes&gt; planes= vtkSmartPointer&lt;vtkPlanes&gt;::New();<br>
</div><div>   planes-&gt;SetBounds(1.5,-1.5,1.5,-1.5,1.5,-1.5);</div></div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px"><div>   vtkSmartPointer&lt;vtkPolyDataMapper&gt; Mapper= vtkSmartPointer&lt;vtkPolyDataMapper&gt;::New();<br>
</div><div>   Mapper-&gt;SetInputConnection(sph-&gt;GetOutputPort());</div><div>   Mapper-&gt;SetClippingPlanes(planes);<br></div><div><br></div><div>   vtkSmartPointer&lt;vtkTransform&gt; tr= vtkSmartPointer&lt;vtkTransform&gt;::New();<br>
</div><div>   tr-&gt;Translate(10,0,0);</div><div><br></div><div>   vtkSmartPointer&lt;vtkActor&gt; Actor= vtkSmartPointer&lt;vtkActor&gt;::New();<br></div><div>   Actor-&gt;SetMapper(Mapper);</div><div>   Actor-&gt;SetUserTransform(tr);</div>
<div><br></div><div>   vtkSmartPointer&lt;vtkAxesActor&gt; axes= vtkSmartPointer&lt;vtkAxesActor&gt;::New();<br></div><div>   axes-&gt;AxisLabelsOff();</div><div><br></div><div>   ren1-&gt;AddActor(Actor);</div><div>   ren1-&gt;AddActor(axes);</div>
<div><br></div><div>   ren1-&gt;ResetCamera();<br></div><div>   renWin-&gt;Render();</div><div>   iren-&gt;Start();</div><div><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/5/6 xabivtk <span dir="ltr">&lt;<a href="mailto:xabivtk@gmail.com" target="_blank">xabivtk@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
For the 5.10 release, the method vtkClipPlanesPainter::UpdateBounds has been<br>
implemented to fix a bug, but i think that there is a transformation missing<br>
for the planes, leading to the incorrect culling of some props in the case<br>
they have a transformation matrix different than identity.<br>
<br>
this-&gt;ClippingPlanes are expressed in world coordinates, after the use of<br>
the actor&#39;s matrix, whereas the bounds are in data coordinates<br>
<br>
To clip the data, the planes are used in<br>
vtkOpenGLClipPlanesPainter::RenderInternal to be passed to glClipPlane after<br>
beeing transformed from world to data coords with the use of the actor&#39;s<br>
matrix.<br>
But in the rendering pipeline we have a call to<br>
vtkClipPlanesPainter::UpdateBounds where these planes are considered to be<br>
in the data coordinates.<br>
<br>
Here is the calling stack:<br>
<br>
vtkClipPlanesPainter::UpdateBounds              ===&gt; original data bounds,<br>
but actor&#39;s world coordinates transformed planes<br>
vtkPainterPolyDataMapper::ComputeBounds<br>
vtkPolyDataMapper::GetBounds<br>
vtkActor::GetBounds                                  ===&gt; actor&#39;s<br>
transformation Matrix applied to the bounds<br>
vtkFrustumCoverageCuller::Cull                    ===&gt; Prop can be<br>
incorrectly culled !!!!<br>
<br>
So in the method vtkClipPlanesPainter::UpdateBounds, the planes should be<br>
transformed with the actor&#39;s matrix before changing the bounds.<br>
<br>
<br>
I used to fill a report in the Mantis Bug Tracker for this kind of bug, but<br>
it seems that vtk has been removed from it...<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://vtk.1045678.n5.nabble.com/Wrong-coordinate-system-for-bounds-computation-in-vtkClipPlanesPainter-tp5720585.html" target="_blank">http://vtk.1045678.n5.nabble.com/Wrong-coordinate-system-for-bounds-computation-in-vtkClipPlanesPainter-tp5720585.html</a><br>

Sent from the VTK - Users mailing list archive at Nabble.com.<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" 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" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</blockquote></div><br></div>