本文整理汇总了C++中Radian函数的典型用法代码示例。如果您正苦于以下问题:C++ Radian函数的具体用法?C++ Radian怎么用?C++ Radian使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Radian函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
}
}
开发者ID:ueverything,项目名称:mmo-resourse,代码行数:28,代码来源:OgreMeshRotationAffector.cpp
示例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;
}
开发者ID:amerkoleci,项目名称:mogre,代码行数:27,代码来源:OgreOverlay.cpp
示例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);
}
开发者ID:jfyne,项目名称:Black-Comrade,代码行数:28,代码来源:lightAndObjectsManager.cpp
示例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)));
}
}
开发者ID:zxycode007,项目名称:Sapphire,代码行数:26,代码来源:SapphireQuaternion.cpp
示例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)));
}
}
开发者ID:bsmr-c-cpp,项目名称:ogre,代码行数:26,代码来源:OgreQuaternion.cpp
示例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();
}
开发者ID:Gohla,项目名称:Diversia,代码行数:31,代码来源:RotationGizmo.cpp
示例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;
}
}
开发者ID:maleiwhat,项目名称:vectorizing-project,代码行数:35,代码来源:Matrix3.cpp
示例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;
}
}
}
}
}
开发者ID:galek,项目名称:erbiqingnian,代码行数:59,代码来源:gearsMeshSerial.cpp
示例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;
}
开发者ID:BackupTheBerlios,项目名称:dsa-hl-svn,代码行数:9,代码来源:MathUtil.cpp
示例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;
}
开发者ID:mettalla,项目名称:dali,代码行数:11,代码来源:pan-gesture-detector-impl.cpp
示例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);
}
开发者ID:Humungo,项目名称:particleuniverse,代码行数:12,代码来源:ParticleUniverseTextureRotator.cpp
示例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;
}
开发者ID:RoboticOxygen,项目名称:extramegablob,代码行数:54,代码来源:MogreVector3.cpp
示例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();
}
开发者ID:Ketzer2002,项目名称:meridian59-engine,代码行数:14,代码来源:ParticleUniverseVortexAffector.cpp
示例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);
}
}
开发者ID:AlfHub,项目名称:BansheeEngine,代码行数:14,代码来源:BsMath.cpp
示例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);
}
}
开发者ID:ttnghia,项目名称:signed-distance-field-generator,代码行数:15,代码来源:OgreMath.cpp
示例16: ASin
Radian ASin( scalar fValue )
{
if ( -1.0 < fValue )
{
if ( fValue < 1.0 )
return Radian(asin(fValue));
else
return Radian(HALF_PI);
}
else
{
return Radian(-HALF_PI);
}
}
开发者ID:whwayne,项目名称:otokowantmiku,代码行数:14,代码来源:MathDefine.cpp
示例17: ACos
Radian ACos( scalar fValue )
{
if ( -1.0 < fValue )
{
if ( fValue < 1.0 )
return Radian(acos(fValue));
else
return Radian(0.0);
}
else
{
return Radian(PI);
}
}
开发者ID:whwayne,项目名称:otokowantmiku,代码行数:14,代码来源:MathDefine.cpp
示例18:
// -----------------------------------------------------------------------------------------
CPepeEngineQuaternion CPepeEngineVector3::getRotationTo(
const CPepeEngineVector3& dest,
const CPepeEngineVector3& fallbackAxis) const
{
// Based on Stan Melax's article in Game Programming Gems
CPepeEngineQuaternion q;
// Copy, since cannot modify local
CPepeEngineVector3 v0 = *this;
CPepeEngineVector3 v1 = dest;
v0.normalise();
v1.normalise();
float d = v0.dotProduct(v1);
// If dot == 1, vectors are the same
if (d >= 1.0f) {
return CPepeEngineQuaternion::IDENTITY;
}
if (d < (1e-6f - 1.0f)) {
if (fallbackAxis != CPepeEngineVector3::ZERO) {
// rotate 180 degrees about the fallback axis
q.fromAngleAxis(Radian(CPepeEngineMath::PI), fallbackAxis);
} else {
// Generate an axis
CPepeEngineVector3 axis = CPepeEngineVector3::UNIT_X.crossProduct(*this);
if (axis.isZeroLength()) { // pick another if colinear
axis = CPepeEngineVector3::UNIT_Y.crossProduct(*this);
}
axis.normalise();
q.fromAngleAxis(Radian(CPepeEngineMath::PI), axis);
}
} else {
float s = CPepeEngineMath::Sqrt((1 + d) * 2);
float invs = 1 / s;
CPepeEngineVector3 c = v0.crossProduct(v1);
q.x = c.x * invs;
q.y = c.y * invs;
q.z = c.z * invs;
q.w = s * 0.5f;
q.normalise();
}
return q;
}
开发者ID:pepewuzzhere,项目名称:PepeEngine,代码行数:50,代码来源:CPepeEngineVector3.cpp
示例19: Vector3
//-----------------------------------------------------------------------
void TerrainCircleLineList::build( TerrainManager* terrainMgr , Vec3 center, Flt radius, Flt gap )
{
Flt girth = 2 * 3.14 * radius;
UInt sectorCount = girth / gap;
UInt maxSectorCount = 100;
if ( sectorCount > maxSectorCount )
sectorCount = maxSectorCount;
if ( sectorCount < 6 )
sectorCount = 6;
Vector3 dir = Vector3( 0, 0, radius );
Flt onceRadianValue = 2 * 3.14 / sectorCount;
Radian onceRadian = Radian( onceRadianValue );
//////////////////////////////////////////////////////
Ogre::Quaternion baseQua;
Flt delta = MGTimeOp::getCurrTick() - mLastBuildTime;
mLastBuildTime = MGTimeOp::getCurrTick();
Flt speed = 0.003;
mBaseRadian += delta * speed * onceRadianValue;
if ( mBaseRadian > 2 * 3.14 )
mBaseRadian = 0;
baseQua.FromAngleAxis( Radian(mBaseRadian), Vector3::UNIT_Y);
dir = baseQua * dir;
//////////////////////////////////////////////////////
Quaternion q;
q.FromAngleAxis( onceRadian, Vector3::UNIT_Y);
//////////////////////////////////////////////////////
mCircleLine.clear();
Vec3 pos;
for ( UInt i=0; i<sectorCount; i++ )
{
pos = center + Vec3(dir.x,dir.y,dir.z);
//////////////////////////////////////////////////////////////////
terrainMgr->getStickHeight( Vec2(pos.x, pos.z), pos.y );
//////////////////////////////////////////////////////////////////
mCircleLine.push_back( pos );
dir = q * dir;
}
}
开发者ID:dnjsflagh1,项目名称:code,代码行数:50,代码来源:TerrainCircleDecorator.cpp
示例20: move
// Move the whirler
void Whirler::move(Real delta) {
// Rotate
mNode->roll(Radian(-10 * delta));
mNode->pitch(Radian(mRotationSpeed * delta));
mFlareNode->roll(Radian(delta * 0.25f));
Vector3 pos = getPosition();
// Try to avoid all moving objects
ObjectMapType::const_iterator i;
ObjectSystem *ob = ObjectSystem::getSingletonPtr();
for(i=ob->getFirst(); i != ob->getLast(); ++i) {
if((*i).second == this || (*i).second->getType() == OTYPE_MUSHROOM) continue;
Vector3 d = pos - (*i).second->getPosition();
d.z = 0;
if(d.squaredLength() > 60.0f*60.0f) continue;
Real dist = d.normalise();
Real effect = 1.0f - (dist / 60.0f);
mCurrentSpeed += d * effect * mSpeed * 3.0f * delta;
}
// ..and player as well
Vector3 d = pos - mPlayer->getPosition();
d.z = 0;
if(d.squaredLength() <= 60.0f*60.0f) {
Real dist = d.normalise();
// If distance is very small, player catches it
if(dist < 3.0f) {
pickUp();
setToBeDeleted();
mPlayer->catchWhirler();
return;
}
Real effect = 1.0f - (dist / 60.0f);
mCurrentSpeed += d * effect * mSpeed * 10.0f * delta;
}
// Cap the speed
if(mCurrentSpeed.squaredLength() >= 55*55) {
mCurrentSpeed = mCurrentSpeed.normalisedCopy() * 55.0f;
}
// Move
mNode->translate(mCurrentSpeed * delta);
mFlareNode->setPosition(mNode->getPosition());
}
开发者ID:fishilico,项目名称:funguloids,代码行数:49,代码来源:whirler.cpp
注:本文中的Radian函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论