本文整理汇总了C++中Quaternion::FromAxisAngle方法的典型用法代码示例。如果您正苦于以下问题:C++ Quaternion::FromAxisAngle方法的具体用法?C++ Quaternion::FromAxisAngle怎么用?C++ Quaternion::FromAxisAngle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Quaternion
的用法示例。
在下文中一共展示了Quaternion::FromAxisAngle方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test
int test(int argc, char ** argv)
{
NUKLEI_TRACE_BEGIN();
/* Parse command line arguments */
TCLAP::CmdLine cmd(INFOSTRING + "Test App." );
/* Standard arguments */
TCLAP::ValueArg<int> niceArg
("", "nice",
"Proccess priority.",
false, NICEINC, "int", cmd);
/* Custom arguments */
TCLAP::UnlabeledValueArg<std::string> fileArg
("file",
"Nuklei file.",
false, "", "filename", cmd);
cmd.parse( argc, argv );
NUKLEI_ASSERT(setpriority(PRIO_PROCESS, 0, niceArg.getValue()) == 0);
Quaternion q(1, 0, 0, 0);
{
Quaternion r;
r.FromAxisAngle(Vector3::UNIT_Z, M_PI/2);
q = r * q;
std::cout << la::normalized(q) << std::endl;
}
{
Quaternion r;
r.FromAxisAngle(Vector3::UNIT_Z, M_PI);
std::cout << la::normalized(r*q) << std::endl;
}
{
Quaternion r;
r.FromAxisAngle(Vector3::UNIT_Y, 90. / 180*M_PI);
std::cout << la::normalized(r*q) << std::endl;
}
{
Quaternion r;
r.FromAxisAngle(Vector3::UNIT_Y, -90. / 180*M_PI);
std::cout << la::normalized(r*q) << std::endl;
}
return 0;
NUKLEI_TRACE_END();
}
示例2: Rotate
void Entity::Rotate(const Vector3F &pAxis, f32 angle){
Matrix4 rotation;
Quaternion quat;
quat.FromAxisAngle(pAxis, angle);
rotation.SetOrientation(quat);
mModelMatrix = rotation * mModelMatrix;
}
示例3: RotateTargetRight
void ArcBallCameraController::RotateTargetRight(float angle_)
{
m_bRecomputeViewMatrix = true;
Quaternion rot;
rot.FromAxisAngle(Up(), -angle_);
Vector3F dir = Direction() * m_fDistance;
Vector3F vec;
rot.Transform(dir, vec);
//Vector3F::Transform(dir, rot, vec);
m_Target += vec - dir;
OrbitRight(-angle_);
}
示例4: UpdateOrientation
void ThirdPersonCamera::UpdateOrientation(real dt)
{
m_pitchDegrees *= dt;
m_headingDegrees *= dt;
m_rollDregrees *= dt;
Quaternion rot;
if (m_headingDegrees != real(0))
{
rot.FromAxisAngle(m_targetYAxis, m_headingDegrees);
m_orientation = m_orientation * rot;
}
if (m_pitchDegrees != real(0))
{
rot.FromAxisAngle(WORLD_XAXIS, m_pitchDegrees);
m_orientation = m_orientation * rot;
}
if(m_rollDregrees != real(0))
{
rot.FromAxisAngle(WORLD_ZAXIS, m_rollDregrees);
m_orientation = m_orientation * rot;
}
}
示例5: DrawAxis
void DrawAxis(bgfx::VertexBufferHandle vertexHandle_, bgfx::ProgramHandle programhandle_)
{
CameraComponent *pCamera = GameInfo::Instance().GetActiveCamera();
Viewport &viewport = pCamera->GetViewport();
Matrix4 matProj, matWorld;
//matWorld.CreateRotationZ(0.5f * MATH_PI);
//matWorld.CreateTranslation(0.0f, 0.0f, -1.0f);
//matWorld.CreateScale(1.0f / (float)CA_DEFAULT_WIDTH, 1.0f / (float)CA_DEFAULT_HEIGHT, 1.0f);
//matWorld.CreateScale(0.989f, 1.0f, 1.0f);
Vector3F scale(0.989f, 1.0f, 1.0f);
Quaternion rot;
rot.FromAxisAngle(Vector3F::UnitZ(), 0.5f * MATH_PI);
matWorld.Transformation(
nullptr, nullptr,
&scale,
nullptr,
&rot, //rotation
nullptr);
matProj.OrthoOffCenter(
static_cast<float>(viewport.X() * CA_DEFAULT_WIDTH), // TODO get screen size
static_cast<float>(viewport.Y() * CA_DEFAULT_HEIGHT),
static_cast<float>(viewport.Width() * CA_DEFAULT_WIDTH),
static_cast<float>(viewport.Height() * CA_DEFAULT_HEIGHT),
0.0f, 1000.0f);
bgfx::setViewTransform(1, NULL, matProj);
//bgfx::setViewTransform(1, pCamera->GetViewMatrix(), pCamera->GetProjectionMatrix());
bgfx::setViewRect(1, 0, 0, Game::Instance()->GetWindow()->getSize().x, Game::Instance()->GetWindow()->getSize().y);
bgfx::setTransform(matWorld);
bgfx::setVertexBuffer(vertexHandle_);
bgfx::setState(BGFX_STATE_RGB_WRITE | BGFX_STATE_MSAA | BGFX_STATE_PT_LINES);
bgfx::submit(1, programhandle_);
}
示例6: CreateFromAxisAngle
/**
\param axis Axis. Should be normalized.
\param angleDeg Angle in degrees.
*/
static Quaternion CreateFromAxisAngle( const Vec3& axis, float angleDeg )
{
Quaternion q;
q.FromAxisAngle( axis, angleDeg );
return q;
}