本文整理汇总了C++中Matrix4d::rotate方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix4d::rotate方法的具体用法?C++ Matrix4d::rotate怎么用?C++ Matrix4d::rotate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix4d
的用法示例。
在下文中一共展示了Matrix4d::rotate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mouseMoveEvent
// Called when the mouse moves
void GLDvrWidget::mouseMoveEvent(QMouseEvent *event) {
std::cout << "GLDvrWidget::mouseMoveEvent()" << std::endl;
// TODO (CA2)
int y = event->y();
int x = event->x();
int dy = y - m_prevMouseY;
int dx = x - m_prevMouseX;
if(event->buttons() & Qt::LeftButton) {
Matrix4d rotX;
rotX.identity();
rotX.rotate(0.5 * dy, Vector3d(1., 0., 0.));
// Update the stored transformation with the one just computed
m_matRotX *= rotX;
Matrix4d rotY;
rotY.identity();
rotY.rotate(0.5*dx,Vector3d(0.,1.,0.));
m_matRotY *= rotY;
}
m_prevMouseX = x;
m_prevMouseY = y;
this->updateContent();
}
示例2: Update
void PropPositioner::Update()
{
m_NeedsUpdate = false;
m_TransformedCurve = m_Curve;
Matrix4d mat;
mat.scale( m_Chord );
if ( m_Reverse < 0 )
{
mat.translatef( 1.0, 0.0, 0.0 );
mat.flipx();
}
m_TransformedCurve.Transform( mat );
if ( !m_ParentProp )
{
return;
}
// Basic transformation orients curve before other transformations.
m_ParentProp->GetBasicTransformation( m_Chord, mat );
m_TransformedCurve.Transform( mat );
mat.loadIdentity();
// Propeller rotation first because order is reversed.
mat.rotateX( -m_Reverse * m_PropRot );
mat.translatef( m_FoldOrigin.x(), m_FoldOrigin.y(), m_FoldOrigin.z() );
mat.rotate( m_FoldAngle * PI / 180.0, m_FoldDirection );
mat.translatef( -m_FoldOrigin.x(), -m_FoldOrigin.y(), -m_FoldOrigin.z() );
mat.rotateY( m_Reverse * m_Feather );
mat.translatef( 0, m_Radius, 0 );
mat.rotateY( m_Reverse * m_Twist );
mat.rotateX( m_XRotate ); // About rake direction
mat.translatef( m_Rake, 0, m_Reverse * m_Skew );
mat.rotateZ( m_ZRotate ); // About chord
m_TransformedCurve.Transform( mat );
}