[vtkusers] vtkProp3D rotations order

Amy Squillacote ahs at cfdrc.com
Thu May 1 09:23:06 EDT 2008


Hi Kerry,

Here's the code for the vtkProp3D::SetOrientation method. The rotations 
are indeed done in the Z, X, Y order.

void vtkProp3D::SetOrientation (double x,double y,double z)
{
  // compute the orientation of the transformation matrix
  // as is done in GetOrientation to make sure we are consistent
  this->Transform->GetOrientation(this->Orientation);

  if (x == this->Orientation[0]
   && y == this->Orientation[1]
   && z == this->Orientation[2])
    {
    return;
    }
  this->IsIdentity = 0;

  // store the coordinates
  this->Orientation[0] = x;
  this->Orientation[1] = y;
  this->Orientation[2] = z;

  vtkDebugMacro(<< " Orientation set to ( "
                << this->Orientation[0] << ", "
                << this->Orientation[1] << ", "
                << this->Orientation[2] << ")\n");

  this->Transform->Identity();
  this->Transform->PreMultiply ();
  this->Transform->RotateZ(this->Orientation[2]);
  this->Transform->RotateX(this->Orientation[0]);
  this->Transform->RotateY(this->Orientation[1]);

  this->Modified();
}


- Amy

Kerry Loux wrote:
> Hello all,
>
> I have an actor that I'm trying to orient in my renderWindow using the 
> vtkActor::SetOrientation(double, double, double) method.  The 
> documentation for this method (I think this is actually found in 
> vtkActor's parent, vtkProp3D) says the rotations are performed as Z, 
> X, Y.  When I give it the proper angles for this scenario, the 
> orientation is off quite a bit.  When I give it the angles that are 
> correct for a rotation order of X, Y, Z, then it orients the actor 
> correctly.  I used MATLAB to check my math, and I think the math is 
> OK.  Has anyone else experienced this?  Is the documentation wrong?  
> I'm using VTK 5.0.4 under MSW.
>
> Thanks,
>
> Kerry
> ------------------------------------------------------------------------
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>   

-- 
Amy Squillacote                    Phone: (256) 726-4839
Computer Scientist                 Fax: (256) 726-4806
CFD Research Corporation           Web: http://www.cfdrc.com
215 Wynn Drive, Suite 501
Huntsville, AL  35805





More information about the vtkusers mailing list