<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Snippet</TITLE>
<META content="text/html; charset=ISO-8859-1" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.23515">
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff text=#000000>
<DIV><FONT size=2 face=Arial>
<DIV><FONT size=2 face=Arial>
<DIV><FONT size=2 face=Arial>Hi Serge,</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT size=2 face=Arial>If it helps your sanity, I can repeat this clipping 
problem in VTK 5.10 using the default interactor with QVTKWidget, which I 
believe is trackball camera, and parallel projection on.</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT size=2 face=Arial>When this happens, I have a 'Fit' option which 
moves the focal point of the camera to the centre of the actors and adjusts the 
parallel scale to fill the view.</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT size=2 face=Arial>John.</FONT></DIV></FONT></DIV></FONT></DIV>
<BLOCKQUOTE 
style="BORDER-LEFT: #000000 2px solid; PADDING-LEFT: 5px; PADDING-RIGHT: 0px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px">
  <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV 
  style="FONT: 10pt arial; BACKGROUND: #e4e4e4; font-color: black"><B>From:</B> 
  <A title=serge@infolytica.com href="mailto:serge@infolytica.com">Serge 
  Lalonde</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>To:</B> <A title=vtkusers@vtk.org 
  href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>Sent:</B> Tuesday, August 20, 2013 8:12 
  PM</DIV>
  <DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [vtkusers] Clipping problem 
  when panning</DIV>
  <DIV><BR></DIV>Well, since I got no responses, I dug deeper and found the code 
  in ParaView that does the rotation and spinning around the center of the 
  visible actors, extracted it and put it into a 
  vtkInteractorStyleTrackballCamera subclass. It hasn't been extensively tested 
  yet, but it seems to work well.<BR><BR>Here it is in case it helps save 
  anybody else 3 days of work.<BR><BR><PRE style="FONT-FAMILY: Consolas; BACKGROUND: white; COLOR: black; FONT-SIZE: 13px">&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: green">//&nbsp;Our&nbsp;subclass&nbsp;of&nbsp;the&nbsp;trackball&nbsp;camera&nbsp;to&nbsp;change&nbsp;the&nbsp;center&nbsp;of&nbsp;rotation&nbsp;to&nbsp;be&nbsp;the&nbsp;average</SPAN>
&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: green">//&nbsp;center&nbsp;of&nbsp;all&nbsp;visible&nbsp;actors&nbsp;instead&nbsp;of&nbsp;the&nbsp;center&nbsp;of&nbsp;the&nbsp;viewport,&nbsp;which&nbsp;always&nbsp;gets&nbsp;clipped.</SPAN>
&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: green">//&nbsp;The&nbsp;default&nbsp;implementation&nbsp;is&nbsp;badly&nbsp;broken&nbsp;and doesn't look to be fixed anytime soon.</SPAN>
&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: green">//&nbsp;The&nbsp;clipping&nbsp;might&nbsp;be&nbsp;fixed&nbsp;with&nbsp;the&nbsp;changes&nbsp;I&nbsp;submitted:&nbsp;<A class=moz-txt-link-freetext href="http://www.vtk.org/Bug/view.php?id=7823">http://www.vtk.org/Bug/view.php?id=7823</A></SPAN>
&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: green">//&nbsp;The&nbsp;new&nbsp;rotation&nbsp;code&nbsp;was&nbsp;taken&nbsp;from&nbsp;ParaView.&nbsp;Specifically,</SPAN>
&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: green">//&nbsp;-&nbsp;Rotate():&nbsp;vtkPVTrackballRotate.cxx&nbsp;OnMouseMove()</SPAN>
&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: green">//&nbsp;-&nbsp;Spin():&nbsp;vtkPVTrackballRoll.cxx&nbsp;OnMouseMove()</SPAN>
&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: green">//&nbsp;-&nbsp;UpdateScreenCenterOfRotation():&nbsp;vtkCameraManipulator.cxx&nbsp;ComputeDisplayCenter()</SPAN>
&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">class</SPAN>&nbsp;<SPAN style="COLOR: blue">InteractorStyleTrackballCamera</SPAN>:&nbsp;<SPAN style="COLOR: blue">public</SPAN>&nbsp;<SPAN style="COLOR: blue">vtkInteractorStyleTrackballCamera</SPAN>
&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">public</SPAN>:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">static</SPAN>&nbsp;<SPAN style="COLOR: blue">InteractorStyleTrackballCamera</SPAN>&nbsp;*<SPAN style="COLOR: #880000">New</SPAN>();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: #a000a0">vtkTypeMacro</SPAN>(<SPAN style="COLOR: blue">InteractorStyleTrackballCamera</SPAN>,&nbsp;<SPAN style="COLOR: blue">vtkInteractorStyleTrackballCamera</SPAN>);
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: green">//&nbsp;This&nbsp;only&nbsp;gets&nbsp;called&nbsp;is&nbsp;CurrentRenderer&nbsp;isn't&nbsp;NULL.</SPAN>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">virtual</SPAN>&nbsp;<SPAN style="COLOR: blue">void</SPAN>&nbsp;<SPAN style="COLOR: #880000">StartRotate</SPAN>()
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">Superclass</SPAN>::<SPAN style="COLOR: #880000">StartRotate</SPAN>();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: #880000">UpdateCenterOfRotation</SPAN>(<SPAN style="COLOR: navy">CurrentRenderer</SPAN>);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: green">//&nbsp;This&nbsp;only&nbsp;gets&nbsp;called&nbsp;is&nbsp;CurrentRenderer&nbsp;isn't&nbsp;NULL.</SPAN>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">virtual</SPAN>&nbsp;<SPAN style="COLOR: blue">void</SPAN>&nbsp;<SPAN style="COLOR: #880000">StartSpin</SPAN>()
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">Superclass</SPAN>::<SPAN style="COLOR: #880000">StartSpin</SPAN>();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: #880000">UpdateCenterOfRotation</SPAN>(<SPAN style="COLOR: navy">CurrentRenderer</SPAN>);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: #880000">UpdateScreenCenterOfRotation</SPAN>(<SPAN style="COLOR: navy">CurrentRenderer</SPAN>);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">virtual</SPAN>&nbsp;<SPAN style="COLOR: blue">void</SPAN>&nbsp;<SPAN style="COLOR: #880000">Rotate</SPAN>()
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">if</SPAN>&nbsp;(<SPAN style="COLOR: navy">CurrentRenderer</SPAN>&nbsp;==&nbsp;<SPAN style="COLOR: #a000a0">NULL</SPAN>)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">return</SPAN>;
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">vtkRenderer</SPAN>&nbsp;*<SPAN style="COLOR: navy">ren</SPAN>=&nbsp;<SPAN style="COLOR: navy">CurrentRenderer</SPAN>;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">vtkCamera</SPAN>&nbsp;*<SPAN style="COLOR: navy">camera</SPAN>=&nbsp;<SPAN style="COLOR: navy">ren</SPAN>-&gt;<SPAN style="COLOR: #880000">GetActiveCamera</SPAN>();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">vtkRenderWindowInteractor</SPAN>&nbsp;*<SPAN style="COLOR: navy">rwi</SPAN>=&nbsp;<SPAN style="COLOR: navy">Interactor</SPAN>;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">vtkTransform</SPAN>&nbsp;*<SPAN style="COLOR: navy">transform</SPAN>=&nbsp;<SPAN style="COLOR: blue">vtkTransform</SPAN>::<SPAN style="COLOR: #880000">New</SPAN>();

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">double</SPAN>&nbsp;<SPAN style="COLOR: navy">scale</SPAN>=&nbsp;<SPAN style="COLOR: blue">vtkMath</SPAN>::<SPAN style="COLOR: #880000">Norm</SPAN>(<SPAN style="COLOR: navy">camera</SPAN>-&gt;<SPAN style="COLOR: #880000">GetPosition</SPAN>());
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">if</SPAN>&nbsp;(<SPAN style="COLOR: navy">scale</SPAN>&nbsp;&lt;=&nbsp;0.0)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">scale</SPAN>=&nbsp;<SPAN style="COLOR: blue">vtkMath</SPAN>::<SPAN style="COLOR: #880000">Norm</SPAN>(<SPAN style="COLOR: navy">camera</SPAN>-&gt;<SPAN style="COLOR: #880000">GetFocalPoint</SPAN>());
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">if</SPAN>&nbsp;(<SPAN style="COLOR: navy">scale</SPAN>&nbsp;&lt;=&nbsp;0.0)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">scale</SPAN>=&nbsp;1.0;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">double</SPAN>&nbsp;*<SPAN style="COLOR: navy">temp</SPAN>=&nbsp;<SPAN style="COLOR: navy">camera</SPAN>-&gt;<SPAN style="COLOR: #880000">GetFocalPoint</SPAN>();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">camera</SPAN>-&gt;<SPAN style="COLOR: #880000">SetFocalPoint</SPAN>(<SPAN style="COLOR: navy">temp</SPAN>[0]/<SPAN style="COLOR: navy">scale</SPAN>,&nbsp;<SPAN style="COLOR: navy">temp</SPAN>[1]/<SPAN style="COLOR: navy">scale</SPAN>,&nbsp;<SPAN style="COLOR: navy">temp</SPAN>[2]/<SPAN style="COLOR: navy">scale</SPAN>);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">temp</SPAN>=&nbsp;<SPAN style="COLOR: navy">camera</SPAN>-&gt;<SPAN style="COLOR: #880000">GetPosition</SPAN>();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">camera</SPAN>-&gt;<SPAN style="COLOR: #880000">SetPosition</SPAN>(<SPAN style="COLOR: navy">temp</SPAN>[0]/<SPAN style="COLOR: navy">scale</SPAN>,&nbsp;<SPAN style="COLOR: navy">temp</SPAN>[1]/<SPAN style="COLOR: navy">scale</SPAN>,&nbsp;<SPAN style="COLOR: navy">temp</SPAN>[2]/<SPAN style="COLOR: navy">scale</SPAN>);

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">double</SPAN>&nbsp;<SPAN style="COLOR: navy">v2</SPAN>[3];
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: green">//&nbsp;translate&nbsp;to&nbsp;center</SPAN>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">transform</SPAN>-&gt;<SPAN style="COLOR: #880000">Identity</SPAN>();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">transform</SPAN>-&gt;<SPAN style="COLOR: #880000">Translate</SPAN>(<SPAN style="COLOR: navy">m_center</SPAN>[0]/<SPAN style="COLOR: navy">scale</SPAN>,&nbsp;<SPAN style="COLOR: navy">m_center</SPAN>[1]/<SPAN style="COLOR: navy">scale</SPAN>,&nbsp;<SPAN style="COLOR: navy">m_center</SPAN>[2]/<SPAN style="COLOR: navy">scale</SPAN>);

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">int</SPAN>&nbsp;<SPAN style="COLOR: navy">dx</SPAN>=&nbsp;<SPAN style="COLOR: navy">rwi</SPAN>-&gt;<SPAN style="COLOR: #880000">GetLastEventPosition</SPAN>()[0]&nbsp;-&nbsp;<SPAN style="COLOR: navy">rwi</SPAN>-&gt;<SPAN style="COLOR: #880000">GetEventPosition</SPAN>()[0];
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">int</SPAN>&nbsp;<SPAN style="COLOR: navy">dy</SPAN>=&nbsp;<SPAN style="COLOR: navy">rwi</SPAN>-&gt;<SPAN style="COLOR: #880000">GetLastEventPosition</SPAN>()[1]&nbsp;-&nbsp;<SPAN style="COLOR: navy">rwi</SPAN>-&gt;<SPAN style="COLOR: #880000">GetEventPosition</SPAN>()[1];

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: green">//&nbsp;azimuth</SPAN>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">camera</SPAN>-&gt;<SPAN style="COLOR: #880000">OrthogonalizeViewUp</SPAN>();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">double</SPAN>&nbsp;*<SPAN style="COLOR: navy">viewUp</SPAN>=&nbsp;<SPAN style="COLOR: navy">camera</SPAN>-&gt;<SPAN style="COLOR: #880000">GetViewUp</SPAN>();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">int</SPAN>&nbsp;*<SPAN style="COLOR: navy">size</SPAN>=&nbsp;<SPAN style="COLOR: navy">ren</SPAN>-&gt;<SPAN style="COLOR: #880000">GetSize</SPAN>();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">transform</SPAN>-&gt;<SPAN style="COLOR: #880000">RotateWXYZ</SPAN>(360.0*<SPAN style="COLOR: navy">dx</SPAN>/<SPAN style="COLOR: navy">size</SPAN>[0],&nbsp;<SPAN style="COLOR: navy">viewUp</SPAN>[0],&nbsp;<SPAN style="COLOR: navy">viewUp</SPAN>[1],&nbsp;<SPAN style="COLOR: navy">viewUp</SPAN>[2]);

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: green">//&nbsp;elevation</SPAN>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">vtkMath</SPAN>::<SPAN style="COLOR: #880000">Cross</SPAN>(<SPAN style="COLOR: navy">camera</SPAN>-&gt;<SPAN style="COLOR: #880000">GetDirectionOfProjection</SPAN>(),&nbsp;<SPAN style="COLOR: navy">viewUp</SPAN>,&nbsp;<SPAN style="COLOR: navy">v2</SPAN>);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">transform</SPAN>-&gt;<SPAN style="COLOR: #880000">RotateWXYZ</SPAN>(-360.0*<SPAN style="COLOR: navy">dy</SPAN>/<SPAN style="COLOR: navy">size</SPAN>[1],&nbsp;<SPAN style="COLOR: navy">v2</SPAN>[0],&nbsp;<SPAN style="COLOR: navy">v2</SPAN>[1],&nbsp;<SPAN style="COLOR: navy">v2</SPAN>[2]);

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: green">//&nbsp;translate&nbsp;back</SPAN>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">transform</SPAN>-&gt;<SPAN style="COLOR: #880000">Translate</SPAN>(-<SPAN style="COLOR: navy">m_center</SPAN>[0]/<SPAN style="COLOR: navy">scale</SPAN>,&nbsp;-<SPAN style="COLOR: navy">m_center</SPAN>[1]/<SPAN style="COLOR: navy">scale</SPAN>,&nbsp;-<SPAN style="COLOR: navy">m_center</SPAN>[2]/<SPAN style="COLOR: navy">scale</SPAN>);

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">camera</SPAN>-&gt;<SPAN style="COLOR: #880000">ApplyTransform</SPAN>(<SPAN style="COLOR: navy">transform</SPAN>);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">camera</SPAN>-&gt;<SPAN style="COLOR: #880000">OrthogonalizeViewUp</SPAN>();

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: green">//&nbsp;For&nbsp;rescale&nbsp;back.</SPAN>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">temp</SPAN>=&nbsp;<SPAN style="COLOR: navy">camera</SPAN>-&gt;<SPAN style="COLOR: #880000">GetFocalPoint</SPAN>();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">camera</SPAN>-&gt;<SPAN style="COLOR: #880000">SetFocalPoint</SPAN>(<SPAN style="COLOR: navy">temp</SPAN>[0]*<SPAN style="COLOR: navy">scale</SPAN>,&nbsp;<SPAN style="COLOR: navy">temp</SPAN>[1]*<SPAN style="COLOR: navy">scale</SPAN>,&nbsp;<SPAN style="COLOR: navy">temp</SPAN>[2]*<SPAN style="COLOR: navy">scale</SPAN>);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">temp</SPAN>=&nbsp;<SPAN style="COLOR: navy">camera</SPAN>-&gt;<SPAN style="COLOR: #880000">GetPosition</SPAN>();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">camera</SPAN>-&gt;<SPAN style="COLOR: #880000">SetPosition</SPAN>(<SPAN style="COLOR: navy">temp</SPAN>[0]*<SPAN style="COLOR: navy">scale</SPAN>,&nbsp;<SPAN style="COLOR: navy">temp</SPAN>[1]*<SPAN style="COLOR: navy">scale</SPAN>,&nbsp;<SPAN style="COLOR: navy">temp</SPAN>[2]*<SPAN style="COLOR: navy">scale</SPAN>);

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">ren</SPAN>-&gt;<SPAN style="COLOR: #880000">ResetCameraClippingRange</SPAN>();

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">rwi</SPAN>-&gt;<SPAN style="COLOR: #880000">Render</SPAN>();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">transform</SPAN>-&gt;<SPAN style="COLOR: #880000">Delete</SPAN>();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">virtual</SPAN>&nbsp;<SPAN style="COLOR: blue">void</SPAN>&nbsp;<SPAN style="COLOR: #880000">Spin</SPAN>()
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">if</SPAN>&nbsp;(<SPAN style="COLOR: navy">CurrentRenderer</SPAN>&nbsp;==&nbsp;<SPAN style="COLOR: #a000a0">NULL</SPAN>)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">return</SPAN>;
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">vtkRenderer</SPAN>&nbsp;*<SPAN style="COLOR: navy">ren</SPAN>=&nbsp;<SPAN style="COLOR: navy">CurrentRenderer</SPAN>;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">vtkCamera</SPAN>&nbsp;*<SPAN style="COLOR: navy">camera</SPAN>=&nbsp;<SPAN style="COLOR: navy">ren</SPAN>-&gt;<SPAN style="COLOR: #880000">GetActiveCamera</SPAN>();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">vtkRenderWindowInteractor</SPAN>&nbsp;*<SPAN style="COLOR: navy">rwi</SPAN>=&nbsp;<SPAN style="COLOR: navy">Interactor</SPAN>;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">double</SPAN>&nbsp;<SPAN style="COLOR: navy">axis</SPAN>[3];

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: green">//&nbsp;compute&nbsp;view&nbsp;vector&nbsp;(rotation&nbsp;axis)</SPAN>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">double</SPAN>&nbsp;*<SPAN style="COLOR: navy">pos</SPAN>=&nbsp;<SPAN style="COLOR: navy">camera</SPAN>-&gt;<SPAN style="COLOR: #880000">GetPosition</SPAN>();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">double</SPAN>&nbsp;*<SPAN style="COLOR: navy">fp</SPAN>=&nbsp;<SPAN style="COLOR: navy">camera</SPAN>-&gt;<SPAN style="COLOR: #880000">GetFocalPoint</SPAN>();

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">axis</SPAN>[0]=&nbsp;<SPAN style="COLOR: navy">fp</SPAN>[0]&nbsp;-&nbsp;<SPAN style="COLOR: navy">pos</SPAN>[0];
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">axis</SPAN>[1]=&nbsp;<SPAN style="COLOR: navy">fp</SPAN>[1]&nbsp;-&nbsp;<SPAN style="COLOR: navy">pos</SPAN>[1];
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">axis</SPAN>[2]=&nbsp;<SPAN style="COLOR: navy">fp</SPAN>[2]&nbsp;-&nbsp;<SPAN style="COLOR: navy">pos</SPAN>[2];

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">int</SPAN>&nbsp;<SPAN style="COLOR: navy">x1</SPAN>,&nbsp;<SPAN style="COLOR: navy">x2</SPAN>,&nbsp;<SPAN style="COLOR: navy">y1</SPAN>,&nbsp;<SPAN style="COLOR: navy">y2</SPAN>;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">x1</SPAN>=&nbsp;<SPAN style="COLOR: navy">rwi</SPAN>-&gt;<SPAN style="COLOR: #880000">GetLastEventPosition</SPAN>()[0]&nbsp;-&nbsp;(<SPAN style="COLOR: blue">int</SPAN>)&nbsp;<SPAN style="COLOR: navy">m_display_center</SPAN>[0];
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">x2</SPAN>=&nbsp;<SPAN style="COLOR: navy">rwi</SPAN>-&gt;<SPAN style="COLOR: #880000">GetEventPosition</SPAN>()[0]&nbsp;-&nbsp;(<SPAN style="COLOR: blue">int</SPAN>)&nbsp;<SPAN style="COLOR: navy">m_display_center</SPAN>[0];
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">y1</SPAN>=&nbsp;<SPAN style="COLOR: navy">rwi</SPAN>-&gt;<SPAN style="COLOR: #880000">GetLastEventPosition</SPAN>()[1]&nbsp;-&nbsp;(<SPAN style="COLOR: blue">int</SPAN>)&nbsp;<SPAN style="COLOR: navy">m_display_center</SPAN>[1];
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">y2</SPAN>=&nbsp;<SPAN style="COLOR: navy">rwi</SPAN>-&gt;<SPAN style="COLOR: #880000">GetEventPosition</SPAN>()[1]&nbsp;-&nbsp;(<SPAN style="COLOR: blue">int</SPAN>)&nbsp;<SPAN style="COLOR: navy">m_display_center</SPAN>[1];
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">if</SPAN>&nbsp;((<SPAN style="COLOR: navy">x2</SPAN>&nbsp;==&nbsp;0.0&nbsp;&amp;&amp;&nbsp;<SPAN style="COLOR: navy">y2</SPAN>&nbsp;==&nbsp;0.0)&nbsp;||&nbsp;(<SPAN style="COLOR: navy">x1</SPAN>&nbsp;==&nbsp;0.0&nbsp;&amp;&amp;&nbsp;<SPAN style="COLOR: navy">y1</SPAN>&nbsp;==&nbsp;0.0))
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: green">//don't&nbsp;ever&nbsp;want&nbsp;to&nbsp;divide&nbsp;by&nbsp;zero</SPAN>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">return</SPAN>;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: green">//&nbsp;-&nbsp;divide&nbsp;by&nbsp;magnitudes&nbsp;to&nbsp;get&nbsp;angle</SPAN>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">double</SPAN>&nbsp;<SPAN style="COLOR: navy">angle</SPAN>=&nbsp;<SPAN style="COLOR: blue">vtkMath</SPAN>::<SPAN style="COLOR: #880000">DegreesFromRadians</SPAN>((<SPAN style="COLOR: navy">x1</SPAN>*<SPAN style="COLOR: navy">y2</SPAN>&nbsp;-&nbsp;<SPAN style="COLOR: navy">y1</SPAN>*<SPAN style="COLOR: navy">x2</SPAN>)/(<SPAN style="COLOR: #a000a0">sqrt</SPAN>(<SPAN style="COLOR: blue">static_cast</SPAN>&lt;<SPAN style="COLOR: blue">double</SPAN>&gt;(<SPAN style="COLOR: navy">x1</SPAN>*<SPAN style="COLOR: navy">x1</SPAN>&nbsp;+&nbsp;<SPAN style="COLOR: navy">y1</SPAN>*<SPAN style="COLOR: navy">y1</SPAN>))*<SPAN style="COLOR: #a000a0">sqrt</SPAN>(<SPAN style="COLOR: blue">static_cast</SPAN>&lt;<SPAN style="COLOR: blue">double</SPAN>&gt;(<SPAN style="COLOR: navy">x2</SPAN>*<SPAN style="COLOR: navy">x2</SPAN>&nbsp;+&nbsp;<SPAN style="COLOR: navy">y2</SPAN>*<SPAN style="COLOR: navy">y2</SPAN>))));

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: green">//&nbsp;translate&nbsp;to&nbsp;center</SPAN>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">vtkTransform</SPAN>&nbsp;*<SPAN style="COLOR: navy">transform</SPAN>=&nbsp;<SPAN style="COLOR: blue">vtkTransform</SPAN>::<SPAN style="COLOR: #880000">New</SPAN>();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">transform</SPAN>-&gt;<SPAN style="COLOR: #880000">Identity</SPAN>();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">transform</SPAN>-&gt;<SPAN style="COLOR: #880000">Translate</SPAN>(<SPAN style="COLOR: navy">m_center</SPAN>[0],&nbsp;<SPAN style="COLOR: navy">m_center</SPAN>[1],&nbsp;<SPAN style="COLOR: navy">m_center</SPAN>[2]);

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: green">//&nbsp;roll</SPAN>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">transform</SPAN>-&gt;<SPAN style="COLOR: #880000">RotateWXYZ</SPAN>(<SPAN style="COLOR: navy">angle</SPAN>,&nbsp;<SPAN style="COLOR: navy">axis</SPAN>[0],&nbsp;<SPAN style="COLOR: navy">axis</SPAN>[1],&nbsp;<SPAN style="COLOR: navy">axis</SPAN>[2]);

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: green">//&nbsp;translate&nbsp;back</SPAN>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">transform</SPAN>-&gt;<SPAN style="COLOR: #880000">Translate</SPAN>(-<SPAN style="COLOR: navy">m_center</SPAN>[0],&nbsp;-<SPAN style="COLOR: navy">m_center</SPAN>[1],&nbsp;-<SPAN style="COLOR: navy">m_center</SPAN>[2]);

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">camera</SPAN>-&gt;<SPAN style="COLOR: #880000">ApplyTransform</SPAN>(<SPAN style="COLOR: navy">transform</SPAN>);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">camera</SPAN>-&gt;<SPAN style="COLOR: #880000">OrthogonalizeViewUp</SPAN>();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">ren</SPAN>-&gt;<SPAN style="COLOR: #880000">ResetCameraClippingRange</SPAN>();

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">rwi</SPAN>-&gt;<SPAN style="COLOR: #880000">Render</SPAN>();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">transform</SPAN>-&gt;<SPAN style="COLOR: #880000">Delete</SPAN>();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
 
&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">protected</SPAN>:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">InteractorStyleTrackballCamera</SPAN>()
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">m_center</SPAN>[0]=&nbsp;<SPAN style="COLOR: navy">m_center</SPAN>[1]=&nbsp;<SPAN style="COLOR: navy">m_center</SPAN>[2]=&nbsp;<SPAN style="COLOR: navy">m_display_center</SPAN>[0]=&nbsp;<SPAN style="COLOR: navy">m_display_center</SPAN>[1]=&nbsp;0;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: green">//&nbsp;Calculate&nbsp;the&nbsp;center&nbsp;of&nbsp;the&nbsp;visible&nbsp;actors.</SPAN>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">void</SPAN>&nbsp;<SPAN style="COLOR: #880000">UpdateCenterOfRotation</SPAN>(<SPAN style="COLOR: blue">vtkRenderer</SPAN>&nbsp;*<SPAN style="COLOR: navy">ren</SPAN>)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">vtkActorCollection</SPAN>&nbsp;*<SPAN style="COLOR: navy">actors</SPAN>=&nbsp;<SPAN style="COLOR: navy">ren</SPAN>-&gt;<SPAN style="COLOR: #880000">GetActors</SPAN>();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">vtkCollectionSimpleIterator</SPAN>&nbsp;<SPAN style="COLOR: navy">cookie</SPAN>;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">vtkActor</SPAN>&nbsp;*<SPAN style="COLOR: navy">actor</SPAN>;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">m_center</SPAN>[0]=&nbsp;<SPAN style="COLOR: navy">m_center</SPAN>[1]=&nbsp;<SPAN style="COLOR: navy">m_center</SPAN>[2]=&nbsp;0;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">actors</SPAN>-&gt;<SPAN style="COLOR: #880000">InitTraversal</SPAN>(<SPAN style="COLOR: navy">cookie</SPAN>);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">while</SPAN>&nbsp;((<SPAN style="COLOR: navy">actor</SPAN>=&nbsp;<SPAN style="COLOR: navy">actors</SPAN>-&gt;<SPAN style="COLOR: #880000">GetNextActor</SPAN>(<SPAN style="COLOR: navy">cookie</SPAN>))&nbsp;!=&nbsp;<SPAN style="COLOR: #a000a0">NULL</SPAN>)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">if</SPAN>&nbsp;(<SPAN style="COLOR: navy">actor</SPAN>-&gt;<SPAN style="COLOR: #880000">GetVisibility</SPAN>())
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">double</SPAN>&nbsp;*<SPAN style="COLOR: navy">actor_center</SPAN>=&nbsp;<SPAN style="COLOR: navy">actor</SPAN>-&gt;<SPAN style="COLOR: #880000">GetCenter</SPAN>();

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">m_center</SPAN>[0]+=&nbsp;<SPAN style="COLOR: navy">actor_center</SPAN>[0];
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">m_center</SPAN>[1]+=&nbsp;<SPAN style="COLOR: navy">actor_center</SPAN>[1];
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">m_center</SPAN>[2]+=&nbsp;<SPAN style="COLOR: navy">actor_center</SPAN>[2];
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">m_center</SPAN>[0]/=&nbsp;<SPAN style="COLOR: navy">actors</SPAN>-&gt;<SPAN style="COLOR: #880000">GetNumberOfItems</SPAN>();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">m_center</SPAN>[1]/=&nbsp;<SPAN style="COLOR: navy">actors</SPAN>-&gt;<SPAN style="COLOR: #880000">GetNumberOfItems</SPAN>();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">m_center</SPAN>[2]/=&nbsp;<SPAN style="COLOR: navy">actors</SPAN>-&gt;<SPAN style="COLOR: #880000">GetNumberOfItems</SPAN>();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: green">//&nbsp;Updates&nbsp;the&nbsp;screen&nbsp;center&nbsp;of&nbsp;rotation.&nbsp;Must&nbsp;be&nbsp;called&nbsp;after&nbsp;UpdateCenterOfRotation(),</SPAN>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">void</SPAN>&nbsp;<SPAN style="COLOR: #880000">UpdateScreenCenterOfRotation</SPAN>(<SPAN style="COLOR: blue">vtkRenderer</SPAN>&nbsp;*<SPAN style="COLOR: navy">ren</SPAN>)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">double</SPAN>&nbsp;*<SPAN style="COLOR: navy">pt</SPAN>;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: green">//&nbsp;save&nbsp;the&nbsp;center&nbsp;of&nbsp;rotation&nbsp;in&nbsp;screen&nbsp;coordinates</SPAN>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">ren</SPAN>-&gt;<SPAN style="COLOR: #880000">SetWorldPoint</SPAN>(<SPAN style="COLOR: navy">m_center</SPAN>[0],&nbsp;<SPAN style="COLOR: navy">m_center</SPAN>[1],&nbsp;<SPAN style="COLOR: navy">m_center</SPAN>[2],&nbsp;1.0);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">ren</SPAN>-&gt;<SPAN style="COLOR: #880000">WorldToDisplay</SPAN>();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">pt</SPAN>=&nbsp;<SPAN style="COLOR: navy">ren</SPAN>-&gt;<SPAN style="COLOR: #880000">GetDisplayPoint</SPAN>();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">m_display_center</SPAN>[0]=&nbsp;<SPAN style="COLOR: navy">pt</SPAN>[0];
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">m_display_center</SPAN>[1]=&nbsp;<SPAN style="COLOR: navy">pt</SPAN>[1];
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
 
&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">private</SPAN>:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">double</SPAN>&nbsp;<SPAN style="COLOR: navy">m_center</SPAN>[3],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: green">//&nbsp;In&nbsp;model&nbsp;coordinates.</SPAN>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy">m_display_center</SPAN>[2];&nbsp;<SPAN style="COLOR: green">//&nbsp;In&nbsp;display&nbsp;coordinates.</SPAN>
&nbsp;&nbsp;&nbsp;};
&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: #a000a0">vtkStandardNewMacro</SPAN>(<SPAN style="COLOR: blue">InteractorStyleTrackballCamera</SPAN>);
</PRE><BR><BR>
  <DIV class=moz-cite-prefix>On 8/13/2013 8:59 AM, Serge Lalonde 
wrote:<BR></DIV>
  <BLOCKQUOTE cite=mid:520A2DB1.2090309@infolytica.com type="cite">I've gotten 
    no replies to this question. Does that mean that no one else has had this 
    problem?<BR><BR>Can someone please confirm that they're using panning with 
    vtkInteractorStyleTrackballCamera without any problems in 
    5.10?<BR><BR>Thanks.<BR><BR>
    <DIV class=moz-cite-prefix>On 8/6/2013 10:49 AM, Serge Lalonde 
    wrote:<BR></DIV>
    <BLOCKQUOTE cite=mid:52010CDD.7000607@infolytica.com type="cite">I tried 
      panning in ParaView and the clipping works properly. Is it using the 
      vtkInteractorStyleTrackballCamera or something else?<BR><BR>The problem is 
      that it looks like the rotation center is wrong after panning, causing the 
      model to be rotated out of the clipping range. It looks like the rotation 
      center is the center of the window instead of the center of the model. 
      Also, I have multiple actors in the scene. Could that be a 
      problem?<BR><BR>I'm not doing anything (that I can tell) to affect this. 
      Could it be a bug in VTK 5.10? If so, does anyone know of a 
      workaround?<BR><BR>Thanks!<BR><BR>
      <DIV class=moz-cite-prefix>On 8/2/2013 3:59 PM, Serge Lalonde 
      wrote:<BR></DIV>
      <BLOCKQUOTE cite=mid:51FC0FB4.50209@infolytica.com type="cite">I notice 
        that when using the vtkInteractorStyleTrackballCamera panning, I'll 
        subsequently see a clipping problem if I rotate the actors 
        afterwards.<BR>Calling ResetCameraClippingRange() on the renderer has no 
        effect. I'm using VTK 5.10.<BR><BR>Is there a workaround for this? It 
        seems like a pretty serious problem. I searched the archives without 
        much success for a fix for this.<BR><BR>Note: Back in October 2008 (5 
        years already!), when I was prototyping with VTK, I posted a fix to 
        vtkusers and <A class=moz-txt-link-abbreviated 
        href="http://www.vtk.org/bug" moz-do-not-send="true">www.vtk.org/bug</A> 
        for vtkRenderer and vtkCamera that fixed a similar clipping problem in 
        VTK 5.2. After examining the 5.10 source code, it looks like the fix was 
        never integrated into VTK's official code branch. The page is <A 
        class=moz-txt-link-freetext 
        href="http://www.vtk.org/Bug/view.php?id=7823" 
        moz-do-not-send="true">http://www.vtk.org/Bug/view.php?id=7823</A> and I 
        noticed that its status is expired. Other users commented in that bug 
        report that it fixed their problems and some even improved the fix. 
      <BR></BLOCKQUOTE><BR>
      <DIV class=moz-signature>-- <BR><A href="http:://www.infolytica.com" 
      moz-do-not-send="true">www.infolytica.com </A><BR>300 Leo Pariseau, Suite 
      2222, Montreal, QC, Canada, H2X 4B3<BR>(514) 849-8752 x236, Fax: (514) 
      849-4239 </DIV><BR>
      <FIELDSET class=mimeAttachmentHeader></FIELDSET> <BR><PRE wrap="">_______________________________________________
Powered by <A class=moz-txt-link-abbreviated href="http://www.kitware.com" moz-do-not-send="true">www.kitware.com</A>

Visit other Kitware open-source projects at <A class=moz-txt-link-freetext href="http://www.kitware.com/opensource/opensource.html" moz-do-not-send="true">http://www.kitware.com/opensource/opensource.html</A>

Please keep messages on-topic and check the VTK FAQ at: <A class=moz-txt-link-freetext href="http://www.vtk.org/Wiki/VTK_FAQ" moz-do-not-send="true">http://www.vtk.org/Wiki/VTK_FAQ</A>

Follow this link to subscribe/unsubscribe:
<A class=moz-txt-link-freetext href="http://www.vtk.org/mailman/listinfo/vtkusers" moz-do-not-send="true">http://www.vtk.org/mailman/listinfo/vtkusers</A>
</PRE></BLOCKQUOTE><BR>
    <DIV class=moz-signature>-- <BR><A href="http:://www.infolytica.com" 
    moz-do-not-send="true">www.infolytica.com </A><BR>300 Leo Pariseau, Suite 
    2222, Montreal, QC, Canada, H2X 4B3<BR>(514) 849-8752 x236, Fax: (514) 
    849-4239 </DIV><BR>
    <FIELDSET class=mimeAttachmentHeader></FIELDSET> <BR><PRE wrap="">_______________________________________________
Powered by <A class=moz-txt-link-abbreviated href="http://www.kitware.com">www.kitware.com</A>

Visit other Kitware open-source projects at <A class=moz-txt-link-freetext href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</A>

Please keep messages on-topic and check the VTK FAQ at: <A class=moz-txt-link-freetext href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</A>

Follow this link to subscribe/unsubscribe:
<A class=moz-txt-link-freetext href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</A>
</PRE></BLOCKQUOTE><BR>
  <DIV class=moz-signature>-- <BR><A 
  href="http:://www.infolytica.com">www.infolytica.com </A><BR>300 Leo Pariseau, 
  Suite 2222, Montreal, QC, Canada, H2X 4B3<BR>(514) 849-8752 x236, Fax: (514) 
  849-4239 </DIV>
  <P>
  <HR>

  <P></P>_______________________________________________<BR>Powered by 
  www.kitware.com<BR><BR>Visit other Kitware open-source projects at 
  http://www.kitware.com/opensource/opensource.html<BR><BR>Please keep messages 
  on-topic and check the VTK FAQ at: 
  http://www.vtk.org/Wiki/VTK_FAQ<BR><BR>Follow this link to 
  subscribe/unsubscribe:<BR>http://www.vtk.org/mailman/listinfo/vtkusers<BR></BLOCKQUOTE></BODY></HTML>