本文整理汇总了C++中glm::quat方法的典型用法代码示例。如果您正苦于以下问题:C++ glm::quat方法的具体用法?C++ glm::quat怎么用?C++ glm::quat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类glm
的用法示例。
在下文中一共展示了glm::quat方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: jointToWorldTest
void jointToWorldTest() {
Joint j0, j1, j2;
// J0 Setup
j0.name = "J0";
j0.parentIndex = -1;
j0.position = vec3(0, 0, 0);
j0.orientation = quat(1, 0, 0, 0); // Identity quaternion
// J1 Setup
j1.name = "J1";
j1.parentIndex = 0;
j1.position.x = 70.1f;
j1.position.y = 70.1f;
j1.orientation = glm::quat_cast(glm::rotate(mat4(), 45.0f, vec3(0, 0, 1)));
j2.name = "J2";
j2.parentIndex = 1;
//j2.position.x = 70.1f;
j2.position.x = 0;
j2.position.y = 100.0f;
//j2.orientation = glm::quat_cast(glm::rotate(mat4(), 45.0f, vec3(0, 0, 1)));
Skeleton skeleton;
skeleton.joints.push_back(j0);
skeleton.joints.push_back(j1);
skeleton.joints.push_back(j2);
buildJointToWorldMatrices(skeleton);
//mat4 worldM = jointToWorld(skeleton, j2);
//cout << "World coordinate: " << worldM[3][0] << ", " << worldM[3][1] << ", " << worldM[3][2] << endl;
}
示例2: quat
TEST( CollisionLibrary, EntitySetGet )
{
ICollisionEntity* entity = g_CollisionDetection.CreateEntity();
const vec3 setPosition = vec3( -3.0f, -11.0f, 7.0f );
const quat setOrientation = quat( 0.0f, 0.0f, 1.0f, 0.0f );
const float setScale = 2.0f;
entity->SetPosition ( setPosition );
entity->SetOrientation ( setOrientation );
entity->SetScale ( setScale );
EXPECT_EQ( setPosition, entity->GetPosition() );
EXPECT_EQ( setOrientation, entity->GetOrientation() );
EXPECT_EQ( setScale, entity->GetScale() );
g_CollisionDetection.DestroyEntity( entity );
g_CollisionDetection.Shutdown();
}
示例3: init
void easygl::init()
{
target = vec3(0, 1, 0);
up = vec3(0, 1, 0);
orientation = quat();
direction = vec3(0, 0, -1);
right = cross(up, direction);
up = cross(direction, right);
position = vec3(5.0f, 5.0f, 5.0f);
fieldOfView = 60.0f;
near = 0.1f, far = 1000.0f;
aspectRatio = 1.0;
dragl = false;
dragr = false;
//sphere.load("sphere.stl", vec4(1.0f, 0.0f, 1.0f, 1.0f));
for(layer &l : d.layers){
l.findcontours();
l.offset(1);
l.show();
}
}
示例4: setUp
void LegacyMathTest::setUp() {
using glm::quat;
using glm::mat3;
// Data from:
// http://www.euclideanspace.com/maths/geometry/rotations/conversions/eulerToQuaternion/steps/index.htm
// http://www.euclideanspace.com/maths/algebra/matrix/transforms/examples/index.htm
// Identity (no rotation)
addTestData(quat( 1.f, 0.0f, 0.0f, 0.0f), Anglef( 0, 0, 0), mat3( 1, 0, 0, 0, 1, 0, 0, 0, 1));
// 90 degrees about y axis
addTestData(quat(0.7071f, 0.0f, 0.7071f, 0.0f), Anglef( 90, 0, 0), mat3( 0, 0, 1, 0, 1, 0, -1, 0, 0));
// 180 degrees about y axis
addTestData(quat( 0.0f, 0.0f, 1.f, 0.0f), Anglef(180, 0, 0), mat3(-1, 0, 0, 0, 1, 0, 0, 0,-1));
// 270 degrees about y axis
addTestData(quat(0.7071f, 0.0f,-0.7071f, 0.0f), Anglef(-90, 0, 0), mat3( 0, 0,-1, 0, 1, 0, 1, 0, 0));
addTestData(quat(0.7071f, 0.0f, 0.0f, 0.7071f), Anglef( 0, 90, 0), mat3( 0,-1, 0, 1, 0, 0, 0, 0, 1));
addTestData(quat( 0.5f, 0.5f, 0.5f, 0.5f), Anglef( 90, 90, 0), mat3( 0, 0, 1, 1, 0, 0, 0, 1, 0));
addTestData(quat( 0.0f, 0.7071f, 0.7071f, 0.0f), Anglef(180, 90, 0), mat3( 0, 1, 0, 1, 0, 0, 0, 0,-1));
addTestData(quat( 0.5f, -0.5f, -0.5f, 0.5f), Anglef(-90, 90, 0), mat3( 0, 0,-1, 1, 0, 0, 0,-1, 0));
addTestData(quat(0.7071f, 0.0f, 0.0f,-0.7071f), Anglef( 0,-90, 0), mat3( 0, 1, 0, -1, 0, 0, 0, 0, 1));
addTestData(quat( 0.5f, -0.5f, 0.5f, -0.5f), Anglef( 90,-90, 0), mat3( 0, 0, 1, -1, 0, 0, 0,-1, 0));
addTestData(quat( 0.0f,-0.7071f, 0.7071f, 0.0f), Anglef(180,-90, 0), mat3( 0,-1, 0, -1, 0, 0, 0, 0,-1));
addTestData(quat( 0.5f, 0.5f, -0.5f, -0.5f), Anglef(-90,-90, 0), mat3( 0, 0,-1, -1, 0, 0, 0, 1, 0));
addTestData(quat(0.7071f, 0.7071f, 0.0f, 0.0f), Anglef( 0, 0, 90), mat3( 1, 0, 0, 0, 0,-1, 0, 1, 0));
addTestData(quat( 0.5f, 0.5f, 0.5f, -0.5f), Anglef( 90, 0, 90), mat3( 0, 1, 0, 0, 0,-1, -1, 0, 0));
addTestData(quat( 0.0f, 0.0f, 0.7071f,-0.7071f), Anglef(180, 0, 90), mat3(-1, 0, 0, 0, 0,-1, 0,-1, 0));
addTestData(quat( 0.5f, 0.5f, -0.5f, 0.5f), Anglef(-90, 0, 90), mat3( 0,-1, 0, 0, 0,-1, 1, 0, 0));
addTestData(quat( 0.0f, 1.0f, 0.0f, 0.0f), Anglef( 0, 0,180), mat3( 1, 0, 0, 0,-1, 0, 0, 0,-1));
addTestData(quat( 0.0f, 0.7071f, 0.0f,-0.7071f), Anglef( 90, 0,180), mat3( 0, 0,-1, 0,-1, 0, -1, 0, 0));
addTestData(quat( 0.0f, 0.0f, 0.0f, 1.0f), Anglef(180, 0,180), mat3(-1, 0, 0, 0,-1, 0, 0, 0, 1));
addTestData(quat( 0.0f, 0.7071f, 0.0f, 0.7071f), Anglef(-90, 0,180), mat3( 0, 0, 1, 0,-1, 0, 1, 0, 0));
addTestData(quat(0.7071f,-0.7071f, 0.0f, 0.0f), Anglef( 0, 0,-90), mat3( 1, 0, 0, 0, 0, 1, 0,-1, 0));
addTestData(quat( 0.5f, -0.5f, 0.5f, 0.5f), Anglef( 90, 0,-90), mat3( 0,-1, 0, 0, 0, 1, -1, 0, 0));
addTestData(quat( 0.0f, 0.0f, 0.7071f, 0.7071f), Anglef(180, 0,-90), mat3(-1, 0, 0, 0, 0, 1, 0, 1, 0));
addTestData(quat( 0.5f, -0.5f, -0.5f, -0.5f), Anglef(-90, 0,-90), mat3( 0, 1, 0, 0, 0, 1, 1, 0, 0));
}