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


C++ Matrix3x3类代码示例

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


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

示例1: GetGlobalOrientation

Matrix3x3 CPhysicsActor::GetGlobalOrientation()
{
	Matrix3x3 orientation;
	NxMat33 tmp = m_Actor->getGlobalOrientation();
	tmp.getColumnMajor( orientation.GetMatrix() );
	return orientation;
}
开发者ID:klhurley,项目名称:ElementalEngine2,代码行数:7,代码来源:CPhysicsActor.cpp

示例2:

//-----------------------------------------------------------------------
void Matrix3x3::EigenSolveSymmetric (double afEigenvalue[3],
    Vector3 akEigenvector[3]) const
{
    Matrix3x3 kMatrix = *this;
    double afSubDiag[3];
    kMatrix.Tridiagonal(afEigenvalue,afSubDiag);
    kMatrix.QLAlgorithm(afEigenvalue,afSubDiag);

    for (size_t i = 0; i < 3; i++)
    {
        akEigenvector[i][0] = kMatrix[0][i];
        akEigenvector[i][1] = kMatrix[1][i];
        akEigenvector[i][2] = kMatrix[2][i];
    }

    // make eigenvectors form a right--handed system
    Vector3 kCross = akEigenvector[1].CrossProduct(akEigenvector[2]);
    double fDet = akEigenvector[0].DotProduct(kCross);
    if ( fDet < 0.0 )
    {
        akEigenvector[2][0] = - akEigenvector[2][0];
        akEigenvector[2][1] = - akEigenvector[2][1];
        akEigenvector[2][2] = - akEigenvector[2][2];
    }
}
开发者ID:issakomi,项目名称:mmt,代码行数:26,代码来源:Matrix3x3.cpp

示例3: transformToMatrix3x3

            void Quaternion::transformToMatrix4x4(double *matrix4x4) const {
                if (matrix4x4 != NULL) {
                    Matrix3x3 result = transformToMatrix3x3();

                    matrix4x4[0] = result.getXX();
                    matrix4x4[1] = result.getXY();
                    matrix4x4[2] = result.getXZ();
                    matrix4x4[3] = 0;

                    // Second row
                    matrix4x4[4] = result.getYX();
                    matrix4x4[5] = result.getYY();
                    matrix4x4[6] = result.getYZ();
                    matrix4x4[7] = 0;

                    // Third row
                    matrix4x4[8] = result.getZX();
                    matrix4x4[9] = result.getZY();
                    matrix4x4[10] = result.getZZ();
                    matrix4x4[11] = 0.;

                    // Fourth row
                    matrix4x4[12] = 0;
                    matrix4x4[13] = 0;
                    matrix4x4[14] = 0;
                    matrix4x4[15] = 1;
                }
            }
开发者ID:Jessie-SEM,项目名称:MiniatureSmartVehicle,代码行数:28,代码来源:Quaternion.cpp

示例4: Determinate

bool CMatrix4x4<T>::GetInverseMatrix(CMatrix4x4 &matInverse) const
{

	T nDeterminate = Determinate();

	int i, j, sign;

	if(fabs(nDeterminate) < 0.0005)
	{
		return false;
	}

	for(i = 0; i < 4; i++)
	{
		for(j = 0; j < 4; j++)
		{

			sign = 1 - ((i+j)%2) * 2;

			Matrix3x3<T> matSub = GetSubMatrix3x3(i,j);

			T det = matSub.Determinate();

			matInverse.m_Entries[i+j*4] = (det * sign)/nDeterminate;

		}//end for
	}//end for

	return true;
}//end GetInverseMatrix
开发者ID:rmuenste,项目名称:FullC0ntact,代码行数:30,代码来源:matrix4x4.cpp

示例5: edge

   // Given an edge, the constructor for EdgeRecord finds the
   // optimal point associated with the edge's current quadric,
   // and assigns this edge a cost based on how much quadric
   // error is observed at this optimal point.
   EdgeRecord::EdgeRecord( EdgeIter& _edge )
   : edge( _edge )
   {
      // TODO Compute the combined quadric from the edge endpoints.
			Matrix4x4 q = _edge->halfedge()->vertex()->quadric +
										_edge->halfedge()->twin()->vertex()->quadric;
		 
      // TODO Build the 3x3 linear system whose solution minimizes
      // the quadric error associated with these two endpoints.
			Matrix3x3 quadratic;
			quadratic(0,0) =  q(0,0); quadratic(0,1) =  q(0,1); quadratic(0,2) =  q(0,2);
			quadratic(1,0) =  q(1,0); quadratic(1,1) =  q(1,1); quadratic(1,2) =  q(1,2);
			quadratic(2,0) =  q(2,0); quadratic(2,1) =  q(2,1); quadratic(2,2) =  q(2,2);
			Vector3D linear(q(3,0), q(3,1), q(3,2));
		 
      // TODO Use this system to solve for the optimal position, and
      // TODO store it in EdgeRecord::optimalPoint.
			optimalPoint = - quadratic.inv() * linear;
		 
      // TODO Also store the cost associated with collapsing this edge
      // TODO in EdgeRecord::Cost.
			Vector4D optH(optimalPoint);
			optH.w = 1.0;
			score = dot(optH, q * optH);
   }
开发者ID:MangoSister,项目名称:MeshEdit,代码行数:29,代码来源:student_code.cpp

示例6: SetPMat

void PPC::SetPMat(){
	Matrix3x3 cam;
	cam.setColumn(0, a);
	cam.setColumn(1, b);
	cam.setColumn(2, c);
	pMat = cam.inverse();
}
开发者ID:ehissey,项目名称:CS434-1,代码行数:7,代码来源:ppc.cpp

示例7: Matrix3x3

		Matrix3x3 &Matrix3x3::Clone( ) const
		{
			Matrix3x3 *pClone = new Matrix3x3( );

			pClone->Copy( *this );

			return *pClone;
		}
开发者ID:FashGek,项目名称:ZED,代码行数:8,代码来源:Matrix3x3.cpp

示例8: TEST

TEST(Matrix3x3, Sum)
{
    const Matrix3x3<int> matrix1(1, 2, 3, 4, 5, 6, 7, 8, 9);
    const Matrix3x3<double> matrix2(10.08, 11.10, 24.5, 24.0, 30.70, 50.50, 70.90, 80.05, 100.70);

    EXPECT_EQ(matrix1.sum(), 45);
    EXPECT_EQ(matrix2.sum(), 402.53);
}
开发者ID:yakushstanislav,项目名称:libcva,代码行数:8,代码来源:Matrix3x3_unittest.cpp

示例9: setRotation

void Node::setRotation( const Matrix3x3& rotation )
{
	assert( rotation.getColumn(0).finite() );
	assert( rotation.getColumn(1).finite() );
	assert( rotation.getColumn(2).finite() );
	assert( ( rotation.getColumn(0).cross(rotation.getColumn(1)) ).dot( rotation.getColumn(2) ) > 0.f ); // Left handed coordinate system?

	m_localTransform.setRotation( rotation );
	m_flags |= NODE_WORLDTMDIRTY;
}
开发者ID:TheRyaz,项目名称:c_reading,代码行数:10,代码来源:Node.cpp

示例10: TEST

TEST(M3x3, opMulti)
{
	Matrix3x3 testMatrix0;
	testMatrix0.FillMatrix(1,2,2,3,4,5,6,7,9);
	Matrix3x3 testMatrix1;
	testMatrix1.FillMatrix(4, 1, 2, 3, 6, 3, 2, 1, 7);
	Matrix3x3 result;
	result.FillMatrix(14, 15, 22, 34, 32, 53, 63, 57, 96);

	EXPECT_EQ(result, (testMatrix0*testMatrix1));
}
开发者ID:BryceX,项目名称:3rd-Project-Library,代码行数:11,代码来源:GTEST.cpp

示例11: cc

            Point3 Point3::operator*(const Matrix3x3 &m) const {
                const double x = getX() * m.getXX() + getY() * m.getXY() + getZ() * m.getXZ();
                const double y = getX() * m.getYX() + getY() * m.getYY() + getZ() * m.getYZ();
                const double z = getX() * m.getZX() + getY() * m.getZY() + getZ() * m.getZZ();

                Point3 cc(x, y, z);
                return cc;
            }
开发者ID:Duxiao777,项目名称:2013-mini-smart-vehicles,代码行数:8,代码来源:Point3.cpp

示例12:

Matrix3x3 Matrix3x3::operator*(const Matrix3x3 &right) const
{
	Matrix3x3 ret;
	for (unsigned int iRow = 0; iRow < 3; iRow++)
	{
		for (unsigned int iCol = 0; iCol < 3; iCol++)
		{
			ret.SetCell(iRow, iCol, this->GetRow(iRow) * right.GetColumn(iCol));
		}
	}
	return ret;
}
开发者ID:BluPhoenix,项目名称:Quadcopter,代码行数:12,代码来源:vector.cpp

示例13: cclock

//check if points of the triangle is counterclockwise
bool cclock( float x0, float y0,
             float x1, float y1,
             float x2, float y2 ) {
  Matrix3x3 m;
  m(0,0) = x0; m(0,1) = x1; m(0,2) = x2;
  m(1,0) = y0; m(1,1) = y1; m(1,2) = y2;
  m(2,0) = 1 ; m(2,1) = 1 ; m(2,2) = 1 ;
  return m.det() >= 0.0;
  /*
  return lineSide(x2 - x0, y2 - y0, x0, y0, x1, y1);
  */
}
开发者ID:yujiex,项目名称:computerGraphics,代码行数:13,代码来源:software_renderer_task5.cpp

示例14: rotateVectorAxisAngle

// this should be moved to the math classes
// NEED NEW VEC CLASS
Vec3 rotateVectorAxisAngle( const Vec3 &vec, const Vec3 &axis, const float angle )
{
    Matrix3x3 mat;
    mat.SetIdentity();
    mat.SetFromAxisAngle( axis, angle );
    Vec3 transformed;
    //need to check the matrix type here carefully
    transformed.x = mat.m[0]*vec.x + mat.m[1]*vec.y + mat.m[2]*vec.z;
    transformed.y = mat.m[3]*vec.x + mat.m[4]*vec.y + mat.m[5]*vec.z;
    transformed.z = mat.m[6]*vec.x + mat.m[7]*vec.y + mat.m[8]*vec.z;
    return transformed;
}
开发者ID:klhurley,项目名称:ElementalEngine2,代码行数:14,代码来源:Frustum.cpp

示例15:

Matrix3x3 Matrix3x3::MulMatrix(Matrix3x3 matrix)
{
	Matrix3x3 ret;
	Matrix3x1 col;

	for(int i = 0; i < 3; i++)
	{
		col = this->MulMatrix3X1(matrix.GetColumn(i));
		ret.SetColumn(col, i);
	}

	return ret;
}
开发者ID:haonguyen14,项目名称:Hexulus,代码行数:13,代码来源:Matrix3x3.cpp


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