get the current orientaion of an actor

Li Gao li at sourcesignal.com
Tue Jul 20 12:41:45 EDT 1999


Hello,

I have some difficulties on getting the current orientation of an actor. My
purpose was to rotate an actor to a specific angle of interest and record
the orientaion so that I can simply display the subsequent actors at that
angle later without rotating each of them. What I did is the following:

// First, after rotating the first actor, the orientation is saved in this
way. Am I right?
void CVtkView::RecordOrientaion()
{
	if (ren)
	{
		double*	angles = ren->GetActiveCamera()->GetOrientation();
		myElevation = angles[0];
		myRoll = angles[2];
		myAzimuth = -angles[1];
	}
}

// Then, I used the following section to force actor to a saved orientation.
Am I right?
void CVtkView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
{
	// initialization stuff and adding actors here
	// ...
	//

	// set up the view angle
	this->ren->ResetCamera();
	this->ren->GetActiveCamera()->SetViewUp(0, 1, 0);
	this->ren->GetActiveCamera()->SetViewPlaneNormal(0, 0, 1);
	this->ren->GetActiveCamera()->Azimuth( myAzimuth );
	this->ren->GetActiveCamera()->Roll( myRoll );
	this->ren->GetActiveCamera()->Elevation( myElevation );
	this->ren->GetActiveCamera()->OrthogonalizeViewUp();
	this->ren->ResetCamera();

	CView::OnUpdate(pSender, lHint, pHint);
}

The above code only works under certain orientation (it worked under
vtk1.3). Could you help me find
out what was wrong? Thank you very much.

Li



-----------------------------------------------------------------------------
This is the private VTK discussion list.  Please keep messages on-topic.
Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at gsao.med.ge.com>.  For help, send message body containing
"info vtkusers" to the same address.     Live long and prosper.
-----------------------------------------------------------------------------





More information about the vtkusers mailing list