本文整理汇总了C++中Matrix3x3函数的典型用法代码示例。如果您正苦于以下问题:C++ Matrix3x3函数的具体用法?C++ Matrix3x3怎么用?C++ Matrix3x3使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Matrix3x3函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: r1
a2de::Matrix3x3 Matrix3x3::operator*(const Matrix3x3& rhs) {
a2de::Vector3D r1(this->GetRowOne());
a2de::Vector3D r2(this->GetRowTwo());
a2de::Vector3D r3(this->GetRowThree());
a2de::Vector3D c1(rhs.GetColumnOne());
a2de::Vector3D c2(rhs.GetColumnTwo());
a2de::Vector3D c3(rhs.GetColumnThree());
return Matrix3x3(a2de::Vector3D::DotProduct(r1, c1), a2de::Vector3D::DotProduct(r1, c2), a2de::Vector3D::DotProduct(r1, c3),
a2de::Vector3D::DotProduct(r2, c1), a2de::Vector3D::DotProduct(r2, c2), a2de::Vector3D::DotProduct(r2, c3),
a2de::Vector3D::DotProduct(r3, c1), a2de::Vector3D::DotProduct(r3, c2), a2de::Vector3D::DotProduct(r3, c3));
}
开发者ID:cugone,项目名称:Abrams2010,代码行数:14,代码来源:CMatrix3x3.cpp
示例17: configure
void configure() {
PhaseFunction::configure();
m_type = EAnisotropic | ENonSymmetric;
Properties props("independent");
m_sampler = static_cast<Sampler*>(PluginManager::getInstance()->createObject(MTS_CLASS(Sampler), props));
m_sampler->configure();
if (m_stddev != -1.f) {
Float sigma1 = m_fiberDistr.sigmaT(0.f) * 2.f;
Float sigma2 = sigma1;
Float sigma3 = m_fiberDistr.sigmaT(1.f) * 2.f;
D = Matrix3x3(Vector(sigma1 * sigma1, 0, 0), Vector(0, sigma2 * sigma2, 0), Vector(0, 0, sigma3 * sigma3));
}
}
开发者ID:winmad,项目名称:mitsuba,代码行数:15,代码来源:SGGX.cpp
示例18: triangle_intersection
static bool
triangle_intersection(const Ray *ray,
const Point3D &p0,
const Point3D &p1,
const Point3D &p2,
double &beta,
double &gamma)
{
Vector3D v1 = p1 - p0;
Vector3D v2 = p2 - p0;
Vector3D r = ray->get_pos() - p0;
double d = Matrix3x3(v1,v2,ray->get_dir()).det();
double d1 = Matrix3x3(r,v2,ray->get_dir()).det();
beta = d1/d;
if (beta < 0)
return false;
double d2 = Matrix3x3(v1, r, ray->get_dir()).det();
gamma = d2/d;
if (gamma < 0 || (beta+gamma) >= 1)
return false;
return true;
}
开发者ID:flotsamthespork,项目名称:Ray-Tracer,代码行数:24,代码来源:mesh.cpp
示例19: Matrix3x3
Matrix3x3 Matrix3x3::Multiply(const Matrix3x3& rhs) const
{
float newMatrix[] =
{
(_elements[0] * rhs._elements[0] + _elements[3] * rhs._elements[1] + _elements[6] * rhs._elements[2]),
(_elements[1] * rhs._elements[0] + _elements[4] * rhs._elements[1] + _elements[7] * rhs._elements[2]),
(_elements[2] * rhs._elements[0] + _elements[5] * rhs._elements[1] + _elements[8] * rhs._elements[2]),
(_elements[0] * rhs._elements[3] + _elements[3] * rhs._elements[4] + _elements[6] * rhs._elements[5]),
(_elements[1] * rhs._elements[3] + _elements[4] * rhs._elements[4] + _elements[7] * rhs._elements[5]),
(_elements[2] * rhs._elements[3] + _elements[5] * rhs._elements[4] + _elements[8] * rhs._elements[5]),
(_elements[0] * rhs._elements[6] + _elements[3] * rhs._elements[7] + _elements[6] * rhs._elements[8]),
(_elements[1] * rhs._elements[6] + _elements[4] * rhs._elements[7] + _elements[7] * rhs._elements[8]),
(_elements[2] * rhs._elements[6] + _elements[5] * rhs._elements[7] + _elements[8] * rhs._elements[8])
};
return Matrix3x3(newMatrix);
}
开发者ID:WilliamRussell,项目名称:Graphics-Core,代码行数:16,代码来源:Matrix3x3.cpp
示例20: assert
Matrix3x3 Matrix3x3::LookAtRotation(const Vector3& eyePos,
const Vector3& targetPos,
const Vector3& unitUpVector)
{
#ifndef NDEBUG
assert(eyePos != targetPos && unitUpVector != Vector3::ZERO);
#endif
// using OpenGL2.1 SDK (gluLookAt)
Vector3 f((targetPos - eyePos).Normalize());
Vector3 s(Vector3::CrossProduct(f, unitUpVector));
Vector3 u(Vector3::CrossProduct(s, f));
return Matrix3x3(s[0], u[0], -f[0],
s[1], u[1], -f[1],
s[2], u[2], -f[2] );
}
开发者ID:dohoang1102,项目名称:fractalTerrain,代码行数:16,代码来源:Matrix3x3.cpp
注:本文中的Matrix3x3函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论