当前位置: 首页>>代码示例>>C++>>正文


C++ Matrixd::ptr方法代码示例

本文整理汇总了C++中Matrixd::ptr方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrixd::ptr方法的具体用法?C++ Matrixd::ptr怎么用?C++ Matrixd::ptr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Matrixd的用法示例。


在下文中一共展示了Matrixd::ptr方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: pushMatrix

 void Camera::pushMatrix(const osg::Matrixd &mat)
 {
     const Matrixd m = mat * qMatrix.back();
     glLoadMatrixd(m.ptr());
     CHECK_GL();
     qMatrix.push_back(m);
 }
开发者ID:agpetit,项目名称:RoDyMan_Vision,代码行数:7,代码来源:camera.cpp

示例2: recordPathEntry

/***************************************************************
*  Function: recordPathEntry()
*
*  Write current scale and xform matrix to file with time stamp
*
***************************************************************/
void PathRecordManager::recordPathEntry(const double &scale, const Matrixd &xMat)
{
    if (!mFilePtr) return;

    fwrite(&mTimer,sizeof(double),1,mFilePtr);

    double scaled = scale;

    fwrite(&scaled,sizeof(double),1,mFilePtr);
    fwrite(xMat.ptr(),16*sizeof(double),1,mFilePtr);
    /*fprintf(mFilePtr, "%f %f ", mTimer, scale);
    fprintf(mFilePtr, "%f %f %f %f ", xMat(0, 0), xMat(0, 1), xMat(0, 2), xMat(0, 3));
    fprintf(mFilePtr, "%f %f %f %f ", xMat(1, 0), xMat(1, 1), xMat(1, 2), xMat(1, 3));
    fprintf(mFilePtr, "%f %f %f %f ", xMat(2, 0), xMat(2, 1), xMat(2, 2), xMat(2, 3));
    fprintf(mFilePtr, "%f %f %f %f ", xMat(3, 0), xMat(3, 1), xMat(3, 2), xMat(3, 3));
    fprintf(mFilePtr, "\n");*/
}
开发者ID:dacevedofeliz,项目名称:calvr_plugins,代码行数:23,代码来源:PathRecordManager.cpp

示例3: preFrame


//.........这里部分代码省略.........
            case 2:
                // For Airplane movement
                rx += angle[1];
                ry -= angle[2];
                y += velocity;  // allow velocity to scale
                break;
            case 3:
                // Old fly mode
                rx += angle[1];
                ry -= coord[0] * .5; // Fixes orientation 
                rz += angle[2];
                y += velocity;  // allow velocity to scale
                break;
            case 5:
                if(node_name != NULL){
                   adjustNode(height, magnitude, position);
                }
                else cout<<"No Node Selected"<<endl;
                break;
        }

        // Scales data by set amount
        x *= transcale;
        y *= transcale;
        z *= transcale;
        rx *= rotscale;
        rz *= rotscale;
        ry *= rotscale;
  
        /*
         * If newMode (which occurs when Drive and New Fly starts),
         *  this takes in a new headMat camera pos.
         * If not, this takes in the old position, with the exception
         *  of the z axis, which corresponds to moving your head up and down
         *  to eliminate conflict between phone and head tracker movement.
         */ 
        Matrix world2head = PluginHelper::getHeadMat();
        Matrix view, mtrans;

        if(useDeviceOrientationTracking){

        	view.makeRotate(orientation,0,0,1);
            mtrans.makeTranslate(world2head.getTrans());
        	view = view * mtrans;
        } else
        	view = world2head;

        Vec3 campos = view.getTrans();

        // Gets translation
        Vec3 trans = Vec3(x, y, z);

        //Test
        if(useHeadTracking){
        	trans = (trans * view) - campos;
        }else if(useDeviceOrientationTracking){
        	trans = (trans * view) - campos;
        }

        Matrix tmat;
        tmat.makeTranslate(trans);

        Vec3 xa = Vec3(1.0, 0.0, 0.0);
        Vec3 ya = Vec3(0.0, 1.0, 0.0);
        Vec3 za = Vec3(0.0, 0.0, 1.0);

        //Test
        if(useHeadTracking){
        	xa = (xa * view) - campos;
        	ya = (ya * view) - campos;
        	za = (za * view) - campos;
        }else if(useDeviceOrientationTracking){
        	xa = (xa * view) - campos;
        	ya = (ya * view) - campos;
        	za = (za * view) - campos;
        }

        // Gets rotation
        Matrix rot;
        rot.makeRotate(rx, xa, ry, ya, rz, za);

        Matrix ctrans, nctrans;
        ctrans.makeTranslate(campos);
        nctrans.makeTranslate(-campos);

        // Calculates new objectMatrix (will send to Slaves).
        //finalmat = PluginHelper::getObjectMatrix() * nctrans * rot * tmat * ctrans;
        finalmat = PluginHelper::getObjectMatrix() * nctrans * rot * tmat * ctrans;
        ComController::instance()->sendSlaves((char *)finalmat.ptr(), sizeof(double[16]));
        PluginHelper::setObjectMatrix(finalmat);
    
    }
    else
    {
        ComController::instance()->readMaster((char *)finalmat.ptr(), sizeof(double[16]));
        PluginHelper::setObjectMatrix(finalmat);
    }

    
}
开发者ID:CalVR,项目名称:calvr_plugins,代码行数:101,代码来源:AndroidNavigator.cpp


注:本文中的Matrixd::ptr方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。