本文整理汇总了C++中QUATERNION::RotateVector方法的典型用法代码示例。如果您正苦于以下问题:C++ QUATERNION::RotateVector方法的具体用法?C++ QUATERNION::RotateVector怎么用?C++ QUATERNION::RotateVector使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QUATERNION
的用法示例。
在下文中一共展示了QUATERNION::RotateVector方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Update
void CAMERA_MOUNT::Update(const MATHVECTOR <float, 3> & newpos, const QUATERNION <float> & newdir, float dt)
{
rotation = newdir * offsetrot;
MATHVECTOR <float, 3> pos = offset;
newdir.RotateVector(pos);
pos = pos + newpos;
MATHVECTOR <float, 3> vel = pos - position;
effect = (vel.Magnitude() - 0.02) / 0.04;
if (effect < 0) effect = 0;
else if (effect > 1) effect = 1;
float bumpdiff = randgen.Get();
float power = pow(bumpdiff, 32);
if (power < 0) power = 0;
else if (power > 0.2) power = 0.2;
float veleffect = std::min(pow(vel.Magnitude() * ( 2.0 - stiffness), 3.0), 1.0);
float bumpimpulse = power * 130.0 * veleffect;
float k = 800.0 + stiffness * 800.0 * 4.0;
float c = 2.0 * std::sqrt(k * mass) * 0.35;
MATHVECTOR <float, 3> bumpforce = direction::Up * bumpimpulse;
MATHVECTOR <float, 3> springforce = -displacement * k;
MATHVECTOR <float, 3> damperforce = -velocity * c;
velocity = velocity + (springforce + damperforce + bumpforce) * dt;
displacement = displacement + velocity * dt;
UpdatePosition(pos);
}
示例2: Reset
void CAMERA_MOUNT::Reset(const MATHVECTOR <float, 3> & newpos, const QUATERNION <float> & newquat)
{
MATHVECTOR <float, 3> pos = offset;
newquat.RotateVector(pos);
rotation = newquat * offsetrot;
displacement.Set(0, 0, 0);
velocity.Set(0, 0, 0);
UpdatePosition(pos + newpos);
}
示例3: Update
void CAMERA_CHASE::Update(const MATHVECTOR <float, 3> & newfocus, const QUATERNION <float> & focus_facing, float dt)
{
focus = newfocus;
MATHVECTOR <float, 3> view_offset = offset;
focus_facing.RotateVector(view_offset);
MATHVECTOR <float, 3> target_position = focus + view_offset;
float posblend = 10.0 * dt;
if (posblend > 1.0) posblend = 1.0;
if (!posblend_on) posblend = 1.0;
position = position * (1.0 - posblend) + target_position * posblend;
rotation = LookAt(position, focus, direction::Up);
}
示例4: up
//simple hinge (arc) suspension displacement
MATHVECTOR<Dbl,3> CARDYNAMICS::GetLocalWheelPosition(WHEEL_POSITION wp, Dbl displacement_percent) const
{
//const
const MATHVECTOR<Dbl,3> & wheelext = wheel[wp].GetExtendedPosition();
const MATHVECTOR<Dbl,3> & hinge = suspension[wp].GetHinge();
MATHVECTOR<Dbl,3> relwheelext = wheelext - hinge;
MATHVECTOR<Dbl,3> up(0,0,1);
MATHVECTOR<Dbl,3> rotaxis = up.cross ( relwheelext.Normalize() );
Dbl hingeradius = relwheelext.Magnitude();
Dbl travel = suspension[wp].GetTravel();
//const
Dbl displacement = displacement_percent * travel;
Dbl displacementradians = displacement / hingeradius;
QUATERNION<Dbl> hingerotate;
hingerotate.Rotate ( -displacementradians, rotaxis[0], rotaxis[1], rotaxis[2] );
MATHVECTOR<Dbl,3> localwheelpos = relwheelext;
hingerotate.RotateVector ( localwheelpos );
return localwheelpos + hinge;
}
示例5: front
RENDER_INPUT_SCENE::RENDER_INPUT_SCENE()
: last_transform_valid(false),
shaders(false),
clearcolor(false),
cleardepth(false),
orthomode(false),
contrast(1.0),
depth_mode(GL_LEQUAL),
writecolor(true),
writedepth(true),
carpainthack(false),
blendmode(BLENDMODE::DISABLED)
{
MATHVECTOR <float, 3> front(1,0,0);
lightposition = front;
QUATERNION <float> ldir;
//ldir.Rotate(3.141593*0.4,0,0,1);
//ldir.Rotate(3.141593*0.5*0.7,1,0,0);
ldir.Rotate(3.141593*0.5,1,0,0);
ldir.RotateVector(lightposition);
}