<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.E-MailFormatvorlage17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
        {page:WordSection1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=DE link=blue vlink=purple>

<div class=WordSection1>

<p class=MsoNormal><span lang=EN-US>Good morning (at least for all those
europeans reading this),<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US>I have a question regarding the method vtkPerspectiveTransform::SetupCamera()
which is used by the vtkCamera to recalculate the view transform matrix. Here
is the complete code of the function since it will be easier to describe what irritates
me:<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>--------------------<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>void
vtkPerspectiveTransform::SetupCamera(const double position[3],<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>                                         
const double focalPoint[3],<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>                                          const
double viewUp[3])<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>{<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>  double matrix[4][4];<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>  vtkMatrix4x4::Identity(*matrix);<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US>  // the view directions correspond to the
rows of the rotation matrix,<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>  // so we'll make the connection explicit<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>  double *viewSideways =    matrix[0];<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>  double *orthoViewUp =     matrix[1];<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>  double *viewPlaneNormal = matrix[2]; <o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US>  // set the view plane normal from the
view vector<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>  viewPlaneNormal[0] = position[0] -
focalPoint[0];<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>  viewPlaneNormal[1] = position[1] -
focalPoint[1];<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>  viewPlaneNormal[2] = position[2] -
focalPoint[2];<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>  vtkMath::Normalize(viewPlaneNormal);<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US>  // orthogonalize viewUp and compute
viewSideways<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US> 
vtkMath::Cross(viewUp,viewPlaneNormal,viewSideways);<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>  vtkMath::Normalize(viewSideways);<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>  vtkMath::Cross(viewPlaneNormal,viewSideways,orthoViewUp);<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US>  // translate by the vector from the
position to the origin<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>  double delta[4];<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>  delta[0] = -position[0];<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>  delta[1] = -position[1];<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>  delta[2] = -position[2];<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>  delta[3] = 0.0; // yes, this should be
zero, not one<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US> 
vtkMatrix4x4::MultiplyPoint(*matrix,delta,delta);<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US>  matrix[0][3] = delta[0]; <o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>  matrix[1][3] = delta[1]; <o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>  matrix[2][3] = delta[2]; <o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US>  // apply the transformation<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>  this-&gt;Concatenate(*matrix);<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>}<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>-------------------<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>The calculation of the three rotation axes
is straight forward but then the position is calculated by multiplying it with
-1 and then with the previously defined rotation matrix. What is the reason for
this?<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>I am working with pose estimation
algorithms with the effect that I have to recalculate my estimated position in
an inverted scheme (multiply with the inverted rotation matrix and then with -1)
to adjust the vtk camera correctly.<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US>Thank you for your answers,<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US>Michael<o:p></o:p></span></p>

</div>

</body>

</html>