本文整理汇总了C++中Radian函数的典型用法代码示例。如果您正苦于以下问题:C++ Radian函数的具体用法?C++ Radian怎么用?C++ Radian使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Radian函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
//-----------------------------------------------------------------------
void MeshRotationAffector::_affectParticles(ParticleSystem* pSystem, Real timeElapsed)
{
ParticleIterator pi = pSystem->_getIterator();
Particle *p;
Real ds;
// Rotation adjustments by time
ds = timeElapsed;
while (!pi.end())
{
p = pi.getNext();
MeshParticleVisualData *data = static_cast<MeshParticleVisualData *>(p->getVisualData());
data->mYawRotation = data->mYawRotation + ds * data->mYawRotationSpeed;
data->mPitchRotation = data->mPitchRotation + ds * data->mPitchRotationSpeed;
data->mRollRotation = data->mRollRotation + ds * data->mRollRotationSpeed;
if ( data->mYawRotation != Radian(0) || data->mPitchRotation != Radian(0) ||
data->mRollRotation != Radian(0) )
pSystem->_notifyParticleRotated();
}
}
示例2: Radian
//---------------------------------------------------------------------
void Overlay::updateTransform(void) const
{
// Ordering:
// 1. Scale
// 2. Rotate
// 3. Translate
Radian orientationRotation = Radian(0);
#if OGRE_NO_VIEWPORT_ORIENTATIONMODE == 0
orientationRotation = Radian(OverlayManager::getSingleton().getViewportOrientationMode() * Math::HALF_PI);
#endif
Matrix3 rot3x3, scale3x3;
rot3x3.FromEulerAnglesXYZ(Radian(0), Radian(0), mRotate + orientationRotation);
scale3x3 = Matrix3::ZERO;
scale3x3[0][0] = mScaleX;
scale3x3[1][1] = mScaleY;
scale3x3[2][2] = 1.0f;
mTransform = Matrix4::IDENTITY;
mTransform = rot3x3 * scale3x3;
mTransform.setTrans(Vector3(mScrollX, mScrollY, 0));
mTransformOutOfDate = false;
}
示例3: attachConLight
void LightAndObjectsManager::attachConLight(Vector3 pos, Vector3 direction, IDrawable *parent)
{
SceneNode *lnode =
sceneNodeMgr->getNode(parent)->createChildSceneNode();
std::stringstream out;
out << lnode->getName();
out << "-" << pos.x << "-" << pos.y << "-" << pos.z;
string lightS = "-conLight";
lightS += out.str();
Light* light = sceneManager->createLight(lightS);
light->setType(Light::LT_SPOTLIGHT);
light->setDiffuseColour(1.0,1.0,1.0);
light->setSpecularColour(1.0,1.0,1.0);
//light->setAttenuation( 100, 1.0, 0.045, 0.0075);
light->setSpotlightInnerAngle(Radian(Degree(5)));
light->setSpotlightOuterAngle(Radian(Degree(100)));
light->setSpotlightFalloff(40.0);
light->setDirection(direction);
//light->setSpotlightRange(Ogre::Degree(20), Ogre::Degree(60), 1.2);
//light->setDirection(Vector3::NEGATIVE_UNIT_Y);
lnode->attachObject(light);
lnode->setPosition(pos);
}
示例4: Radian
//-----------------------------------------------------------------------
Radian Quaternion::getYaw(bool reprojectAxis) const
{
if (reprojectAxis)
{
// yaw = atan2(localz.x, localz.z)
//拾取部分 zAxis() 实现我们需要
Real fTx = 2.0f*x;
Real fTy = 2.0f*y;
Real fTz = 2.0f*z;
Real fTwy = fTy*w;
Real fTxx = fTx*x;
Real fTxz = fTz*x;
Real fTyy = fTy*y;
// Vector3(fTxz+fTwy, fTyz-fTwx, 1.0-(fTxx+fTyy));
return Radian(Math::ATan2(fTxz + fTwy, 1.0f - (fTxx + fTyy)));
}
else
{
// 实现我们需要
return Radian(Math::ASin(-2 * (x*z - w*y)));
}
}
示例5: Radian
//-----------------------------------------------------------------------
Radian Quaternion::getYaw(bool reprojectAxis) const
{
if (reprojectAxis)
{
// yaw = atan2(localz.x, localz.z)
// pick parts of zAxis() implementation that we need
Real fTx = 2.0f*x;
Real fTy = 2.0f*y;
Real fTz = 2.0f*z;
Real fTwy = fTy*w;
Real fTxx = fTx*x;
Real fTxz = fTz*x;
Real fTyy = fTy*y;
// Vector3(fTxz+fTwy, fTyz-fTwx, 1.0-(fTxx+fTyy));
return Radian(Math::ATan2(fTxz+fTwy, 1.0f-(fTxx+fTyy)));
}
else
{
// internal version
return Radian(Math::ASin(-2*(x*z - w*y)));
}
}
示例6: Radian
void RotationGizmo::update()
{
mArrowNode->setScale( Gizmo::getSceneNode()->getScale() );
Ogre::Radian rfAngle = Ogre::Radian( (mDirector.x * (Real)mMouse->mMouseState.x.rel) -
(mDirector.y * (Real)mMouse->mMouseState.y.rel) ) * 0.02;
if( Gizmo::isSnappingToGrid() )
{
mRotationAccumulator += toRadian<Radian>( rfAngle );
if( mRotationAccumulator.valueDegrees() >= 45 )
{
Gizmo::getControlledObject()->rotate( toVector3<Vector3>( mRotationAxis ),
Radian( Degree( 45 ) ), Node::TS_LOCAL );
mRotationAccumulator = 0;
}
else if( mRotationAccumulator.valueDegrees() <= -45 )
{
Gizmo::getControlledObject()->rotate( toVector3<Vector3>( mRotationAxis ),
Radian( Degree( -45 ) ), Node::TS_LOCAL );
mRotationAccumulator = 0;
}
}
else
{
Gizmo::getControlledObject()->rotate( toVector3<Vector3>( mRotationAxis ),
toRadian<Radian>( rfAngle ), Node::TS_LOCAL );
}
mMouse->mMouseState.clear();
}
示例7: Radian
//-----------------------------------------------------------------------
bool Matrix3::ToEulerAnglesZYX(Radian& rfYAngle, Radian& rfPAngle,
Radian& rfRAngle) const
{
// rot = cy*cz cz*sx*sy-cx*sz cx*cz*sy+sx*sz
// cy*sz cx*cz+sx*sy*sz -cz*sx+cx*sy*sz
// -sy cy*sx cx*cy
rfPAngle = Math::ASin(-m[2][0]);
if (rfPAngle < Radian(Math::HALF_PI))
{
if (rfPAngle > Radian(-Math::HALF_PI))
{
rfYAngle = Math::ATan2(m[1][0], m[0][0]);
rfRAngle = Math::ATan2(m[2][1], m[2][2]);
return true;
}
else
{
// WARNING. Not a unique solution.
Radian fRmY = Math::ATan2(-m[0][1], m[0][2]);
rfRAngle = Radian(0.0); // any angle works
rfYAngle = rfRAngle - fRmY;
return false;
}
}
else
{
// WARNING. Not a unique solution.
Radian fRpY = Math::ATan2(-m[0][1], m[0][2]);
rfRAngle = Radian(0.0); // any angle works
rfYAngle = fRpY - rfRAngle;
return false;
}
}
示例8: rotate
void GearsMeshBuilder::rotate( scalar rotX,scalar rotY,scalar rotZ )
{
Matrix3 mat;
mat.FromEulerAnglesXYZ(Radian(rotX),Radian(rotY),Radian(rotZ));
Quaternion quat(mat);
{
MeshSkeletonVector::Iterator i;
for (i=mMySkeletons.Begin(); i!=mMySkeletons.End(); ++i)
{
MeshSkeleton *ms = (*i);
for (int32 j=0; j<ms->mBoneCount; j++)
{
MeshBone &b = ms->mBones[j];
if ( b.mParentIndex == -1 )
{
b.mPosition = quat * b.mPosition;
b.mOrientation = quat * b.mOrientation;
}
}
}
}
{
GearMeshVector::Iterator i;
for (i=mMyMeshes.Begin(); i!=mMyMeshes.End(); ++i)
{
GearMesh *m = (*i);
uint32 vcount = m->mVertexPool.GetSize();
if ( vcount > 0 )
{
MeshVertex *vb = m->mVertexPool.GetBuffer();
for (uint32 j=0; j<vcount; j++)
{
vb->mPos = quat * vb->mPos;
vb++;
}
}
}
}
{
MeshAnimationVector::Iterator i;
for (i=mMyAnimations.Begin(); i!=mMyAnimations.End(); ++i)
{
MeshAnimation *ma = (*i);
for (int32 j=0; j<ma->mTrackCount && j <1; j++)
{
MeshAnimTrack *t = ma->mTracks[j];
for (int32 k=0; k<t->mFrameCount; k++)
{
MeshAnimPose &p = t->mPose[k];
p.mPos = quat * p.mPos;
p.mQuat = quat * p.mQuat;
}
}
}
}
}
示例9: Radian
Ogre::Vector3 MathUtil::sphericalToCartesian(Ogre::Real r,
Ogre::Radian azimuth, Ogre::Radian altitude)
{
Vector3 rval;
rval.x = r*Math::Sin(azimuth)*Math::Sin(altitude + Radian(Math::HALF_PI));
rval.y = r*Math::Cos(altitude + Radian(Math::HALF_PI));
rval.z = r*Math::Cos(azimuth)*Math::Sin(altitude + Radian(Math::HALF_PI));
return rval;
}
示例10: ret
PanGestureDetector::AngleThresholdPair PanGestureDetector::GetAngle(size_t index) const
{
PanGestureDetector::AngleThresholdPair ret( Radian(0),Radian(0) );
if( index < mAngleContainer.size() )
{
ret = mAngleContainer[index];
}
return ret;
}
示例11: ParticleAffector
//-----------------------------------------------------------------------
TextureRotator::TextureRotator(void) :
ParticleAffector(),
mUseOwnRotationSpeed(DEFAULT_USE_OWN_SPEED),
mScaledRotationSpeed(Radian(0)),
twoPiRad(Radian(Math::TWO_PI))
{
mDynRotation = PU_NEW_T(DynamicAttributeFixed, MEMCATEGORY_SCENE_OBJECTS)();
(static_cast<DynamicAttributeFixed*>(mDynRotation))->setValue(DEFAULT_ROTATION);
mDynRotationSpeed = PU_NEW_T(DynamicAttributeFixed, MEMCATEGORY_SCENE_OBJECTS)();
(static_cast<DynamicAttributeFixed*>(mDynRotationSpeed))->setValue(DEFAULT_ROTATION_SPEED);
}
示例12:
Quaternion Vector3::GetRotationTo(Vector3 dest, Vector3 fallbackAxis)
{
// Based on Stan Melax's article in Game Programming Gems
Quaternion q;
// Copy, since cannot modify local
Vector3 v0 = *this;
Vector3 v1 = dest;
v0.Normalise();
v1.Normalise();
Real d = v0.DotProduct(v1);
// If dot == 1, vectors are the same
if (d >= 1.0f)
{
return Quaternion::IDENTITY;
}
// sometimes the dot product yields -1.0000001
// floating point math does that to you
if (d < -1.0f)
d = -1.0f;
Real s = Math::Sqrt( (1+d)*2 );
if (s < 1e-6f)
{
if (fallbackAxis != Vector3::ZERO)
{
// rotate 180 degrees about the fallback axis
q.FromAngleAxis(Radian(Math::PI), fallbackAxis);
}
else
{
// Generate an axis
Vector3 axis = Vector3::UNIT_X.CrossProduct(*this);
if (axis.IsZeroLength) // pick another if colinear
axis = Vector3::UNIT_Y.CrossProduct(*this);
axis.Normalise();
q.FromAngleAxis(Radian(Math::PI), axis);
}
}
else
{
Real invs = 1 / s;
Vector3 c = v0.CrossProduct(v1);
q.x = c.x * invs;
q.y = c.y * invs;
q.z = c.z * invs;
q.w = s * 0.5;
q.Normalise();
}
return q;
}
示例13: _preProcessParticles
//-----------------------------------------------------------------------
void VortexAffector::_preProcessParticles(ParticleTechnique* particleTechnique, Real timeElapsed)
{
ParticleSystem* sys = mParentTechnique->getParentSystem();
if (sys)
{
mRotation.FromAngleAxis(Radian(_calculateRotationSpeed() * timeElapsed), sys->getDerivedOrientation() * mRotationVector);
}
else
{
mRotation.FromAngleAxis(Radian(_calculateRotationSpeed() * timeElapsed), mRotationVector);
}
getDerivedPosition();
}
示例14: Radian
Radian Math::acos(float val)
{
if (-1.0f < val)
{
if (val < 1.0f)
return Radian(std::acos(val));
else
return Radian(0.0f);
}
else
{
return Radian(PI);
}
}
示例15: Radian
//-----------------------------------------------------------------------
Radian Math::ASin (Real fValue)
{
if ( -1.0 < fValue )
{
if ( fValue < 1.0 )
return Radian(asin(fValue));
else
return Radian(HALF_PI);
}
else
{
return Radian(-HALF_PI);
}
}