本文整理汇总了C++中SbRotation::inverse方法的典型用法代码示例。如果您正苦于以下问题:C++ SbRotation::inverse方法的具体用法?C++ SbRotation::inverse怎么用?C++ SbRotation::inverse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SbRotation
的用法示例。
在下文中一共展示了SbRotation::inverse方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: copyCameraSettings
static
void copyCameraSettings(SoCamera* cam1, SbRotation& rot_cam1, SbVec3f& pos_cam1,
SoCamera* cam2, SbRotation& rot_cam2, SbVec3f& pos_cam2)
{
// recompute the diff we have applied to the camera's orientation
SbRotation rot = cam1->orientation.getValue();
SbRotation dif = rot * rot_cam1.inverse();
rot_cam1 = rot;
// copy the values
cam2->enableNotify(false);
cam2->nearDistance = cam1->nearDistance;
cam2->farDistance = cam1->farDistance;
cam2->focalDistance = cam1->focalDistance;
reorientCamera(cam2,dif);
rot_cam2 = cam2->orientation.getValue();
// reverse engineer the translation part in wc
SbVec3f pos = cam1->position.getValue();
SbVec3f difpos = pos - pos_cam1;
pos_cam1 = pos;
// the translation in pixel coords
cam1->orientation.getValue().inverse().multVec(difpos,difpos);
// the translation again in wc for the second camera
cam2->orientation.getValue().multVec(difpos,difpos);
cam2->position.setValue(cam2->position.getValue()+difpos);
if (cam1->getTypeId() == cam2->getTypeId()) {
if (cam1->getTypeId() == SoOrthographicCamera::getClassTypeId())
static_cast<SoOrthographicCamera*>(cam2)->height =
static_cast<SoOrthographicCamera*>(cam1)->height;
}
cam2->enableNotify(true);
}
示例2:
/*!
Should be called after motion matrix has been updated by a child
dragger.
*/
void
SoCenterballDragger::transferCenterDraggerMotion(SoDragger * childdragger)
{
if (coin_assert_cast<SoNode *>(childdragger) == XCenterChanger.getValue() ||
coin_assert_cast<SoNode *>(childdragger) == YCenterChanger.getValue() ||
coin_assert_cast<SoNode *>(childdragger) == ZCenterChanger.getValue()) {
// translate part of matrix should not change. Move motion
// into center instead.
SbVec3f transl;
SbMatrix matrix = this->getMotionMatrix();
transl[0] = matrix[3][0];
transl[1] = matrix[3][1];
transl[2] = matrix[3][2];
SbVec3f difftransl = transl - this->savedtransl;
{ // consider rotation before translating
SbRotation rot = this->rotation.getValue();
SbMatrix tmp;
tmp.setRotate(rot.inverse());
tmp.multVecMatrix(difftransl, difftransl);
}
this->centerFieldSensor->detach();
this->center = difftransl + this->savedcenter;
this->centerFieldSensor->attach(&this->center);
matrix[3][0] = this->savedtransl[0];
matrix[3][1] = this->savedtransl[1];
matrix[3][2] = this->savedtransl[2];
SbBool oldval = this->enableValueChangedCallbacks(FALSE);
this->setMotionMatrix(matrix);
this->enableValueChangedCallbacks(oldval);
SoMatrixTransform *mt = SO_GET_ANY_PART(this, "translateToCenter", SoMatrixTransform);
matrix.setTranslate(this->center.getValue());
mt->matrix = matrix;
}
}