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


C++ Matrix3x3函数代码示例

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


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

示例1: tred3

/**
 * \brief Tridiagonalizes a 3x3 matrix using a single
 * Householder transformation and returns the result.
 *
 * Based on "Geometric Tools" by David Eberly.
 */
static inline void tred3(Matrix3x3 &m, Float *diag, Float *subd) {
	Float m00 = m(0, 0), m01 = m(0, 1), m02 = m(0, 2),
	      m11 = m(1, 1), m12 = m(1, 2), m22 = m(2, 2);

	diag[0] = m00;
	subd[2] = 0;
	if (std::abs(m02) > std::numeric_limits<Float>::epsilon()) {
		Float length = std::sqrt(m01*m01 + m02*m02),
			  invLength = 1 / length;
		m01 *= invLength;
		m02 *= invLength;
		Float q = 2*m01*m12 + m02*(m22 - m11);
		diag[1] = m11 + m02*q;
		diag[2] = m22 - m02*q;
		subd[0] = length;
		subd[1] = m12 - m01*q;
		m = Matrix3x3(
			1, 0, 0,
			0, m01, m02,
			0, m02, -m01);
	} else {
		/* The matrix is already tridiagonal,
		   return an identity transformation matrix */
		diag[1] = m11;
		diag[2] = m22;
		subd[0] = m01;
		subd[1] = m12;
		m = Matrix3x3(
			1, 0, 0,
			0, 1, 0,
			0, 0, 1);
	}
}
开发者ID:AdrianJohnston,项目名称:ShapeNetRender,代码行数:39,代码来源:transform.cpp

示例2: Matrix3x3

Matrix3x3 Matrix3x3::rotation(const Vector3& axis, float angleRadians) {
  float angle = -angleRadians;
  return Matrix3x3(
    (axis.x * axis.x) * (1 - cos(angle)) + cos(angle)         , axis.x * axis.y * (1 - cos(angle)) + axis.z * sin(angle), (axis.x * axis.z) * (1 - cos(angle)) - axis.y * sin(angle),
    (axis.x * axis.y) * (1 - cos(angle)) - axis.z * sin(angle), axis.y * axis.y * (1 - cos(angle)) + cos(angle)         , (axis.y * axis.z) * (1 - cos(angle)) + axis.x * sin(angle),
    (axis.x * axis.z) * (1 - cos(angle)) + axis.y * sin(angle), axis.y * axis.z * (1 - cos(angle)) - axis.x * sin(angle), (axis.z * axis.z) * (1 - cos(angle)) + cos(angle));
}
开发者ID:gwowen,项目名称:indigo,代码行数:7,代码来源:Matrix3x3.cpp

示例3: Vector3

Matrix3x3 Quaternion::rotationMatrix3x3() const
{
    Vector3 col1 = Vector3(1.0f - 2.0f * (y * y + z * z), 2.0f * (x * y + w * z), 2.0f * (x * z - w * y));
    Vector3 col2 = Vector3(2.0f * (x * y -  w * z), 1.0f - 2.0f * (x * x + z * z), 2.0f * (y * z + w * x));
    Vector3 col3 = Vector3(2.0f * (x * z + w * y), 2.0f * (y * z - w * x), 1.0f - 2.0f * (x * x + y * y));
    return Matrix3x3(col1, col2, col3);
}
开发者ID:A-K,项目名称:Huurre3D,代码行数:7,代码来源:Quaternion.cpp

示例4: Matrix3x3

Matrix3x3 Matrix3x3::CompMax(const Matrix3x3& m1,
                             const Matrix3x3& m2)
{
	return Matrix3x3(Vector3::CompMax(m1[0], m2[0]),
	                 Vector3::CompMax(m1[1], m2[1]),
	                 Vector3::CompMax(m1[2], m2[2]));
}
开发者ID:dohoang1102,项目名称:fractalTerrain,代码行数:7,代码来源:Matrix3x3.cpp

示例5: Matrix3x3

// Return the transpose matrix
inline Matrix3x3 Matrix3x3::getTranspose() const {

    // Return the transpose matrix
    return Matrix3x3(mRows[0][0], mRows[1][0], mRows[2][0],
                     mRows[0][1], mRows[1][1], mRows[2][1],
                     mRows[0][2], mRows[1][2], mRows[2][2]);
}
开发者ID:jagoly,项目名称:reactphysics3d,代码行数:8,代码来源:Matrix3x3.hpp

示例6: get_unistate_mat3

Matrix3x3 get_unistate_mat3(const char *name)
{
	int sidx = get_unistate_index(name);
	if(sidx == -1) {
		return Matrix3x3();
	}
	return get_unistate_mat3(sidx);
}
开发者ID:Gordath,项目名称:mars2030,代码行数:8,代码来源:unistate.cpp

示例7: Matrix3x3

Matrix3x3 Matrix3x3::operator+( const Matrix3x3& rhs ) const
{
	return Matrix3x3(
		_00+rhs._00, _01+rhs._01, _02+rhs._02,
		_10+rhs._10, _11+rhs._11, _12+rhs._12,
		_20+rhs._20, _21+rhs._21, _22+rhs._22 
	);
}
开发者ID:ggomdyu,项目名称:TGON_ModelJoy,代码行数:8,代码来源:Matrix3x3.cpp

示例8: matScale

Matrix3x3
matScale(double x,
         double y)
{
    return Matrix3x3(x,  0., 0.,
                     0., y,  0.,
                     0., 0., 1.);
}
开发者ID:ChristianHeckl,项目名称:Natron,代码行数:8,代码来源:Transform.cpp

示例9: matTranslation

Matrix3x3
matTranslation(double x,
               double y)
{
    return Matrix3x3(1., 0., x,
                     0., 1., y,
                     0., 0., 1.);
}
开发者ID:ChristianHeckl,项目名称:Natron,代码行数:8,代码来源:Transform.cpp

示例10: matRotation

Matrix3x3
matRotation(double rads)
{
    double c = std::cos(rads);
    double s = std::sin(rads);

    return Matrix3x3(c, s, 0, -s, c, 0, 0, 0, 1);
}
开发者ID:ChristianHeckl,项目名称:Natron,代码行数:8,代码来源:Transform.cpp

示例11: matSkewXY

Matrix3x3
matSkewXY(double skewX,
          double skewY,
          bool skewOrderYX)
{
    return Matrix3x3(skewOrderYX ? 1. : (1. + skewX * skewY), skewX, 0.,
                     skewY, skewOrderYX ? (1. + skewX * skewY) : 1, 0.,
                     0., 0., 1.);
}
开发者ID:ChristianHeckl,项目名称:Natron,代码行数:9,代码来源:Transform.cpp

示例12: set_view_matrix

void TargetCamera::set_camera(long time)
{
	set_view_matrix(get_matrix());
	set_unistate("st_view_matrix3",Matrix3x3(get_matrix()));

    //DEBUG
    Matrix4x4 view = get_matrix();
    glMatrixMode(GL_MODELVIEW);
    glLoadTransposeMatrixf(view[0]);
}
开发者ID:Gordath,项目名称:mars2030,代码行数:10,代码来源:camera.cpp

示例13: Matrix3x3

Matrix3x3 Matrix3x3::Transpose() const
{
    float data[9];
    int cnt = 0;

    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            data[cnt++] = data_[j][i];
        }
    }

    return Matrix3x3(data);
}
开发者ID:gviau,项目名称:sketch-3d,代码行数:13,代码来源:Matrix3x3.cpp

示例14: matMul

Matrix3x3
matMul(const Matrix3x3 & m1,
       const Matrix3x3 & m2)
{
    return Matrix3x3(m1.a * m2.a + m1.b * m2.d + m1.c * m2.g,
                     m1.a * m2.b + m1.b * m2.e + m1.c * m2.h,
                     m1.a * m2.c + m1.b * m2.f + m1.c * m2.i,
                     m1.d * m2.a + m1.e * m2.d + m1.f * m2.g,
                     m1.d * m2.b + m1.e * m2.e + m1.f * m2.h,
                     m1.d * m2.c + m1.e * m2.f + m1.f * m2.i,
                     m1.g * m2.a + m1.h * m2.d + m1.i * m2.g,
                     m1.g * m2.b + m1.h * m2.e + m1.i * m2.h,
                     m1.g * m2.c + m1.h * m2.f + m1.i * m2.i);
}
开发者ID:ChristianHeckl,项目名称:Natron,代码行数:14,代码来源:Transform.cpp

示例15: tmp

Matrix3x3 Matrix3x3::getTranspose()
{

    std::vector<float> tmp(9);

    for (int i = 0; i < 3; i++)
    {
        tmp[3 * i] = elements[i];
        tmp[3 * i + 1] = elements[i + 3];
        tmp[3 * i + 2] = elements[i + 6];
    }

    return Matrix3x3(tmp);
}
开发者ID:tritenour01,项目名称:raytracer,代码行数:14,代码来源:matrix.cpp


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