<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 ==> the actor is culled</div><div><br></div></div><div style="font-family:arial,sans-serif;font-size:13px">
<div>#include <vtkActor.h></div><div>#include <vtkAxesActor.h></div><div>#include <vtkPolyDataMapper.h><br></div><div>#include <vtkRenderer.h><br></div><div>#include <vtkRenderWindow.h></div>
<div>#include <vtkRenderWindowInteractor.h></div><div>#include <vtkSmartPointer.h></div><div>#include <vtkSphereSource.h></div><div>#include <vtkPlanes.h></div><div>#include <vtkTransform.h><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<vtkRenderer> ren1= vtkSmartPointer<vtkRenderer>::New();<br>
</div><div> ren1->SetBackground(0.4, 0.4, 0.5);</div><div> ren1->SetBackground2(0.2,0.2,0.3);</div><div> ren1->SetGradientBackground(true);</div><div><br></div><div> vtkSmartPointer<vtkRenderWindow> renWin= vtkSmartPointer<vtkRenderWindow>::New();<br>
</div><div> renWin->SetSize( 972, 800 );</div><div> renWin->AddRenderer(ren1);</div><div><br></div><div> vtkSmartPointer<vtkRenderWindowInteractor> iren= vtkSmartPointer<vtkRenderWindowInteractor>::New();<br>
</div><div> iren->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<vtkSphereSource> sph= vtkSmartPointer<vtkSphereSource>::New();<br>
</div><div> sph->SetPhiResolution(22);</div><div> sph->SetThetaResolution(22);</div><div> sph->SetRadius(2.0);</div><div> sph->Update();</div><div><br></div><div> vtkSmartPointer<vtkPlanes> planes= vtkSmartPointer<vtkPlanes>::New();<br>
</div><div> planes->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<vtkPolyDataMapper> Mapper= vtkSmartPointer<vtkPolyDataMapper>::New();<br>
</div><div> Mapper->SetInputConnection(sph->GetOutputPort());</div><div> Mapper->SetClippingPlanes(planes);<br></div><div><br></div><div> vtkSmartPointer<vtkTransform> tr= vtkSmartPointer<vtkTransform>::New();<br>
</div><div> tr->Translate(10,0,0);</div><div><br></div><div> vtkSmartPointer<vtkActor> Actor= vtkSmartPointer<vtkActor>::New();<br></div><div> Actor->SetMapper(Mapper);</div><div> Actor->SetUserTransform(tr);</div>
<div><br></div><div> vtkSmartPointer<vtkAxesActor> axes= vtkSmartPointer<vtkAxesActor>::New();<br></div><div> axes->AxisLabelsOff();</div><div><br></div><div> ren1->AddActor(Actor);</div><div> ren1->AddActor(axes);</div>
<div><br></div><div> ren1->ResetCamera();<br></div><div> renWin->Render();</div><div> iren->Start();</div><div><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/5/6 xabivtk <span dir="ltr"><<a href="mailto:xabivtk@gmail.com" target="_blank">xabivtk@gmail.com</a>></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->ClippingPlanes are expressed in world coordinates, after the use of<br>
the actor'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'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 ===> original data bounds,<br>
but actor's world coordinates transformed planes<br>
vtkPainterPolyDataMapper::ComputeBounds<br>
vtkPolyDataMapper::GetBounds<br>
vtkActor::GetBounds ===> actor's<br>
transformation Matrix applied to the bounds<br>
vtkFrustumCoverageCuller::Cull ===> Prop can be<br>
incorrectly culled !!!!<br>
<br>
So in the method vtkClipPlanesPainter::UpdateBounds, the planes should be<br>
transformed with the actor'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>