本文整理汇总了C++中Matrixd类的典型用法代码示例。如果您正苦于以下问题:C++ Matrixd类的具体用法?C++ Matrixd怎么用?C++ Matrixd使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Matrixd类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Vec3d
osg::Matrixd CameraController::calcMatrixBasedOnAxis( const Vec3d& origin, const Vec3d& axisY, const Vec3d& axisZ )
{
Matrixd matTrans;
matTrans.makeTranslate(origin);
Vec3d oldY = Vec3d(0, 1, 0);
Vec3d oldZ = Vec3d(0, 0, 1);
Vec3d newY = axisY;
Vec3d newZ = axisZ;
newY.normalize();
newZ.normalize();
Matrixd mat1;
mat1.makeRotate(oldZ, newZ);
oldY = oldY * mat1;
Matrixd mat2;
mat2.makeRotate(oldY, newY);
Matrixd matFinal = mat1 * mat2 * matTrans;
return matFinal;
}
示例2: if
/***************************************************************
* Function: applyEditorInfo()
***************************************************************/
void CAVEGroupEditGeodeWireframe::applyEditorInfo(CAVEGeodeShape::EditorInfo **infoPtr)
{
/* reset root offset only when the shape is moved */
if ((*infoPtr)->getTypeMasking() == CAVEGeodeShape::EditorInfo::MOVE)
{
/* apply translations on 'mAccRootMat' */
const Vec3 offset = (*infoPtr)->getMoveOffset();
Matrixd transMat;
transMat.makeTranslate(offset);
mAccRootMat = mAccRootMat * transMat;
}
else if ((*infoPtr)->getTypeMasking() == CAVEGeodeShape::EditorInfo::ROTATE)
{
/* apply rotations on 'mAccRootMat' */
const float angle = (*infoPtr)->getRotateAngle();
const Vec3 axis = (*infoPtr)->getRotateAxis();
Matrixf rotateMat;
rotateMat.makeRotate(angle, axis);
mAccRootMat = mAccRootMat * rotateMat;
}
else if ((*infoPtr)->getTypeMasking() == CAVEGeodeShape::EditorInfo::SCALE)
{
const Vec3f scaleVect = (*infoPtr)->getScaleVect();
const Vec3f scaleCenter = (*infoPtr)->getScaleCenter();
Matrixd scalingMat, transMat, revTransMat;
scalingMat.makeScale(scaleVect);
transMat.makeTranslate(scaleCenter);
revTransMat.makeTranslate(-scaleCenter);
mAccRootMat = mAccRootMat * scalingMat;
}
}
示例3: glLoadMatrixd
void Camera::pushMatrix(const osg::Matrixd &mat)
{
const Matrixd m = mat * qMatrix.back();
glLoadMatrixd(m.ptr());
CHECK_GL();
qMatrix.push_back(m);
}
示例4: sendMatrix
void MyServerThread::sendMatrix(Matrixd transNode)
{
float matrix1[16];
Vec3 objTrans = transNode.getTrans();
Quat objQuad = transNode.getRotate();
//cout << " Orientation " << objQuad.x() << "," << objQuad.y() << "," << objQuad.z() << "," << objQuad.w() << endl; // orientation
//cout << " Postion " << objTrans.x() << "," << objTrans.y() << "," << objTrans.z() << endl; // position
/*for (int i=0; i<4; ++i){
for (int j=0; j<4; ++j)
{
cout << transNode(i,j) << " " ; // position
}
cout << endl;
} */
cout << endl;
for (int i=0; i<4; ++i)
for (int j=0; j<4; ++j)
matrix[i*4+j] = transNode(i,j);
for(int i=0; i<16; i++)
{
cout <<"matrix:" << i << " " << matrix1[i] << endl;
}
//memcpy(buf,matrix1,sizeof(float)*16);
//sendMSG();
}
示例5: calcMatrixBasedOnAxis
void CameraController::updateEyeAndAtToWorldMatrix()
{
_testEyeToWorldMatrix = calcMatrixBasedOnAxis(_testEye, _testUp, _testEye - _testAt);
Matrixd mat;
mat.makeTranslate(_testAt - _testEye);
_testAtToWorldMatrix = _testEyeToWorldMatrix * mat;
}
示例6: setMatrixTrans
void CAVEGeodeIconToolkitManipulate::setMatrixTrans(MatrixTransform *matTrans)
{
Matrixd offsetMat;
offsetMat.makeTranslate(Vec3(mScalingDir.x() * mBoundingVect.x(),
mScalingDir.y() * mBoundingVect.y(),
mScalingDir.z() * mBoundingVect.z()));
matTrans->setMatrix(offsetMat);
}
示例7: getMatrix
void SceneGraphManipulator::setInteractionMode(int mode, Vec3f center, float imageZoom)
{
if (_trackerMode == -1) _trackerMode = 0; // if ProjectionType is UNKNOWN treat it as VISION
else _trackerMode = mode;
Matrixd viewMat = getMatrix();
float C = 1.5;
_panRating = C * (viewMat.preMult(center)).length() / imageZoom; //(viewMat.preMult(center)).length() is the distance between the eye and the center of the viewed scene
}
示例8: switchCoordinateSystem_point
Vec3d CameraController::switchCoordinateSystem_point( const Vec3d& point, const Matrixd& from, const Matrixd& to )
{
Matrixd mat;
mat.invert(to);
Vec3d v = point * from * mat;
return v;
}
示例9: calcVertex64
virtual void calcVertex64(Vector3Dd* vtx) {
Matrixd matrix;
matrix.translate(m_origin);
matrix.rotate(m_direction, Vector3Dd(0.0f,0.0f,1.0f));
matrix.scale(m_scale);
for (size_t n = 0; n < VertexCount; ++n) {
vtx[n] = matrix.mult(ts::gobj::Building3D::buildingVertex[n]);
}
}
示例10: setByMatrix
/** Set the position of the manipulator using a 4x4 matrix.*/
void FirstPersonManipulator::setByMatrix( const Matrixd& matrix )
{
// set variables
_eye = matrix.getTrans();
_rotation = matrix.getRotate();
// fix current rotation
if( getVerticalAxisFixed() )
fixVerticalAxis( _eye, _rotation, true );
}
示例11: calcUp
Vec3d CameraController::calcUp(const Vec3d& oldSight, const Vec3d& newSight, const Vec3d& oldUp)
{
Vec3d v1 = oldSight, v2 = newSight;
v1.normalize();
v2.normalize();
Matrixd mat;
mat.makeRotate(v1, v2);
Vec3d newUp = oldUp * mat;
return newUp;
}
示例12: setEquatorPos
/***************************************************************
* Function: setEquatorPos()
***************************************************************/
void DSVirtualEarth::setEquatorPos(const float &t)
{
/* get virtual time based on longi/lati/date */
float vtime = (mLongi + 180.f) / 15.f + 12 + (mDate - gDateOffset) * 24 + mTimeOffset;
vtime = vtime - (int)(vtime / 24.f) * 24.f;
mTimeOffset += (t - vtime);
Matrixd rotMat;
rotMat.makeRotate(mTimeOffset / 12.f * M_PI, Vec3(0, 0, 1));
mEquatorTrans->setMatrix(rotMat);
}
示例13: updateUnitGridSizeInfo
/***************************************************************
* Function: updateUnitGridSizeInfo()
***************************************************************/
void CAVEGroupReferenceAxis::updateUnitGridSizeInfo(const string &infoStr)
{
if (mTextEnabledFlag)
{
mGridInfoText->setText("Unit size = " + infoStr);
mGridInfoText->setPosition(Vec3(0, -gCharSize, -gCharSize));
/* align the text to viewer's front direction */
Matrixd rotMat;
rotMat.makeRotate(Vec3(0, 1, 0), gPointerDir);
mGridInfoTextTrans->setMatrix(Matrixd(rotMat));
}
}
示例14: switchCoordinateSystem_vector
Vec3d CameraController::switchCoordinateSystem_vector( const Vec3d& vec, const Matrixd& from, const Matrixd& to )
{
Matrixd mat;
mat.invert(to);
Vec3d begin = Vec3d(0, 0, 0);
Vec3d end = vec;
Vec3d begin2 = begin * from * mat;
Vec3d end2 = end * from * mat;
Vec3d v = end2 - begin2;
return v;
}
示例15: getOCSMatrix
/// hum. read the doc, then come back here. then try to figure.
void
dxfInsert::drawScene(scene* sc)
{
// INSERTs can be nested. So pull the current matrix
// and push it back after we fill our context
// This is a snapshot in time. I will rewrite all this to be cleaner,
// but for now, it seems working fine
// (with the files I have, the results are equal to Voloview,
// and better than Deep Exploration and Lightwave).
// sanity check (useful when no block remains after all unsupported entities have been filtered out)
if (!_block)
return;
Matrixd back = sc->backMatrix();
Matrixd m;
m.makeIdentity();
sc->pushMatrix(m, true);
Vec3d trans = _block->getPosition();
sc->blockOffset(-trans);
if (_rotation) {
sc->pushMatrix(Matrixd::rotate(osg::DegreesToRadians(_rotation), 0,0,1));
}
sc->pushMatrix(Matrixd::scale(_scale.x(), _scale.y(), _scale.z()));
sc->pushMatrix(Matrixd::translate(_point.x(), _point.y(), _point.z()));
getOCSMatrix(_ocs, m);
sc->pushMatrix(m);
sc->pushMatrix(back);
EntityList& l = _block->getEntityList();
for (EntityList::iterator itr = l.begin(); itr != l.end(); ++itr) {
dxfBasicEntity* e = (*itr)->getEntity();
if (e) {
e->drawScene(sc);
}
}
sc->popMatrix(); // ocs
sc->popMatrix(); // translate
sc->popMatrix(); // scale
if (_rotation) {
sc->popMatrix(); // rotate
}
sc->popMatrix(); // identity
sc->popMatrix(); // back
sc->blockOffset(Vec3d(0,0,0));
}