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


C++ SbMatrix::multRight方法代码示例

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


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

示例1: appendTransform

void MicrotubuleTransformOperation::appendTransform(HxParameter* p,
                                                    const SbMatrix& mat) {
    // get existing transform m
    SbMatrix m;
    double res[16];
    if (p->getDimension() == 16) {
        p->getReal(res);
        float* ptr = &m[0][0];
        for (int i = 0; i < 16; ++i) {
            ptr[i] = float(res[i]);
        }
    } else {
        m.makeIdentity();
    }
    // append transform mat and write parameter
    m.multRight(mat);
    p->set(16, &m[0][0]);
}
开发者ID:zibamira,项目名称:microtubulestitching,代码行数:18,代码来源:MicrotubuleTransformOperation.cpp

示例2: InventorTriangleCB

/**
 * This method extracts the triangle given by \p v1, \p v2, \p v3 and stores
 * it in the TriMeshModel instance passed in through \p data by calling
 * TriMeshModel::addTriangleWithFace() with the extracted triangle.
 */
void CoinVisualizationNode::InventorTriangleCB(void* data, SoCallbackAction* action,
        const SoPrimitiveVertex* v1,
        const SoPrimitiveVertex* v2,
        const SoPrimitiveVertex* v3)
{
	TriMeshModel* triangleMeshModel = static_cast<TriMeshModel*>(data);

	if (!triangleMeshModel)
	{
		VR_INFO << ": Internal error, NULL data" << endl;
		return;
	}

	SbMatrix mm = action->getModelMatrix();
    SbMatrix scale;
    scale.setScale(1000.0f); // simox operates in mm, coin3d in m
    mm = mm.multRight(scale);
	SbVec3f triangle[3];
	mm.multVecMatrix(v1->getPoint(), triangle[0]);
	mm.multVecMatrix(v2->getPoint(), triangle[1]);
	mm.multVecMatrix(v3->getPoint(), triangle[2]);
	SbVec3f normal[3];
	/*mm.multVecMatrix(v1->getNormal(), normal[0]);
	mm.multVecMatrix(v2->getNormal(), normal[1]);
	mm.multVecMatrix(v3->getNormal(), normal[2]);*/
	mm.multDirMatrix(v1->getNormal(), normal[0]);
	mm.multDirMatrix(v2->getNormal(), normal[1]);
	mm.multDirMatrix(v3->getNormal(), normal[2]);

	normal[0] = (normal[0] + normal[1] + normal[2]) / 3.0f;


	// read out vertices
	Eigen::Vector3f a, b, c, n;
	a << triangle[0][0], triangle[0][1], triangle[0][2];
	b << triangle[1][0], triangle[1][1], triangle[1][2];
	c << triangle[2][0], triangle[2][1], triangle[2][2];
	n << normal[0][0], normal[0][1], normal[0][2];
	// add new triangle to the model
	triangleMeshModel->addTriangleWithFace(a, b, c, n);
}
开发者ID:TheMarex,项目名称:simox,代码行数:46,代码来源:CoinVisualizationNode.cpp

示例3: difftrans

/*! \COININTERNAL */
void
SoCenterballDragger::valueChangedCB(void *, SoDragger * d)
{
  SoCenterballDragger * thisp = static_cast<SoCenterballDragger *>(d);
  SbMatrix matrix = thisp->getMotionMatrix();
  SbVec3f t, s;
  SbRotation r, so;

  // Eliminate center variable of matrix
  if (thisp->savedcenter != SbVec3f(0.0f, 0.0f, 0.0f)) {
    SbMatrix trans;
    trans.setTranslate(thisp->savedcenter);
    matrix.multLeft(trans);
    trans.setTranslate(-(thisp->savedcenter));
    matrix.multRight(trans);
  }

  // Do an inverse rotation, using matrix with center eliminated
  // to obtain correct translation
  matrix.getTransform(t, r, s, so);
  SbMatrix rotmat;
  rotmat.setRotate(r);
  //SbMatrix tmp = matrix;
  matrix.multLeft(rotmat.inverse());

  // Update center of object if dragger has translated
  SbVec3f difftrans(matrix[3][0], matrix[3][1], matrix[3][2]);
  if (difftrans != SbVec3f(0.0f, 0.0f, 0.0f)) {
    thisp->centerFieldSensor->detach();
    thisp->center.setValue(thisp->savedcenter + difftrans);
    thisp->centerFieldSensor->attach(&thisp->center);
  }

  thisp->rotFieldSensor->detach();
  if (thisp->rotation.getValue() != r) {
    thisp->rotation = r;
  }
  thisp->rotFieldSensor->attach(&thisp->rotation);
}
开发者ID:Alexpux,项目名称:Coin3D,代码行数:40,代码来源:SoCenterballDragger.cpp


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