Пример #1
0
Geometry::Point<double,3> MapTool::
getPosition()
{
    Vrui::NavTrackerState nav = Vrui::getDeviceTransformation(getButtonDevice(0));
    Vrui::NavTrackerState::Vector trans = nav.getTranslation();
    return Geometry::Point<double,3>(trans[0], trans[1], trans[2]);
}
void UnitDragger::updateDragger(const Vrui::NavTrackerState& currentTransformation)
	{
	/* Calculate new transformation and increment transformation: */
	DragTransform newTransform=DragTransform(currentTransformation.getTranslation(),currentTransformation.getRotation());
	NCK::Rotation dr=newTransform.getRotation()*Geometry::invert(influenceSphereTransform.getRotation());
	NCK::Vector dt=newTransform.getTranslation()-influenceSphereTransform.getTranslation();
	
	/* Update dragger's current position, orientation and radius: */
	influenceSphereTransform=newTransform;
	influenceSphereRadius=application->influenceSphereRadius*currentTransformation.getScaling();
	
	/* Calculate dragger's linear and angular velocities: */
	linearVelocity=dt;
	angularVelocity=dr.getScaledAxis();
	}