本文整理汇总了C++中LLQuaternion::shortestArc方法的典型用法代码示例。如果您正苦于以下问题:C++ LLQuaternion::shortestArc方法的具体用法?C++ LLQuaternion::shortestArc怎么用?C++ LLQuaternion::shortestArc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLQuaternion
的用法示例。
在下文中一共展示了LLQuaternion::shortestArc方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fireCurrentBeams
void lggBeamMaps::fireCurrentBeams(LLPointer<LLHUDEffectSpiral> mBeam, const LLColor4U& rgb)
{
if (mScale == 0.0f)
{
return;
}
static LLCachedControl<std::string> colorf(gSavedSettings, "FSBeamColorFile");
bool colorsDisabled = (colorf().empty());
for (std::vector<lggBeamData>::iterator it = mDots.begin(); it != mDots.end(); ++it)
{
LLColor4U myColor = rgb;
if (colorsDisabled)
{
myColor = (*it).c;
}
F32 distanceAdjust = dist_vec(mBeam->getPositionGlobal(), gAgent.getPositionGlobal());
F32 pulse = (F32)(.75f + sinf(gFrameTimeSeconds * 1.0f) * 0.25f);
LLVector3d offset = (*it).p;
offset.mdV[VY] *= -1.f;
offset *= pulse * mScale * distanceAdjust * 0.1f;
LLVector3 beamLine = LLVector3( mBeam->getPositionGlobal() - gAgent.getPositionGlobal());
LLVector3 beamLineFlat = beamLine;
beamLineFlat.mV[VZ]= 0.0f;
LLVector3 newDirFlat = LLVector3::x_axis;
beamLine.normalize();
beamLineFlat.normalize();
LLQuaternion change;
change.shortestArc(newDirFlat, beamLineFlat);
offset.rotVec(change);
newDirFlat.rotVec(change);
change.shortestArc(newDirFlat, beamLine);
offset.rotVec(change);
LLPointer<LLHUDEffectSpiral> myBeam = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM);
myBeam->setPositionGlobal(mBeam->getPositionGlobal() + offset + (LLVector3d(beamLine) * sinf(gFrameTimeSeconds * 2.0f) * 0.2f));
myBeam->setColor(myColor);
myBeam->setTargetObject(mBeam->getTargetObject());
myBeam->setSourceObject(mBeam->getSourceObject());
myBeam->setNeedsSendToSim(mBeam->getNeedsSendToSim());
myBeam->setDuration(mDuration * 1.2f);
}
}
示例2: fireCurrentBeams
void lggBeamMaps::fireCurrentBeams(LLPointer<LLHUDEffectSpiral> mBeam, LLColor4U rgb)
{
if (scale == 0.0f)
{
return;
}
static LLCachedControl<std::string> colorf(gSavedSettings, "FSBeamColorFile");
bool colorsDisabled = std::string(colorf) == "===OFF===";
for(int i = 0; i < (int)dots.size(); i++)
{
LLColor4U myColor = rgb;
if (colorsDisabled) myColor = dots[i].c;
F32 distanceAdjust = dist_vec(mBeam->getPositionGlobal(),gAgent.getPositionGlobal()) ;
F32 pulse = (F32)(.75f+sinf(gFrameTimeSeconds*1.0f)*0.25f);
LLVector3d offset = dots[i].p;
offset.mdV[VY] *= -1;
offset *= pulse * scale * distanceAdjust * 0.1;
//llinfos << "dist is " << distanceAdjust << "scale is " << scale << llendl;
LLVector3 beamLine = LLVector3( mBeam->getPositionGlobal() - gAgent.getPositionGlobal());
LLVector3 beamLineFlat = beamLine;
beamLineFlat.mV[VZ]= 0.0f;
LLVector3 newDirFlat = LLVector3::x_axis;
beamLine.normalize();
beamLineFlat.normalize();
LLQuaternion change;
change.shortestArc(newDirFlat,beamLineFlat);
offset.rotVec(change);
newDirFlat.rotVec(change);
change.shortestArc(newDirFlat,beamLine);
offset.rotVec(change);
LLPointer<LLHUDEffectSpiral> myBeam = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM);
myBeam->setPositionGlobal(mBeam->getPositionGlobal() + offset + (LLVector3d(beamLine) * sinf(gFrameTimeSeconds*2.0f) * 0.2f));
myBeam->setColor(myColor);
myBeam->setTargetObject(mBeam->getTargetObject());
myBeam->setSourceObject(mBeam->getSourceObject());
myBeam->setNeedsSendToSim(mBeam->getNeedsSendToSim());
myBeam->setDuration(duration* 1.2f);
}
}
示例3: if
//.........这里部分代码省略.........
abbcOrthoVec.normVec();
F32 agLenSq = agLen * agLen;
// angle arm for extension
F32 cosTheta = (agLenSq - abLen*abLen - bcLen*bcLen) / (2.0f * abLen * bcLen);
if (cosTheta > 1.0f)
cosTheta = 1.0f;
else if (cosTheta < -1.0f)
cosTheta = -1.0f;
F32 theta = acos(cosTheta);
LLQuaternion bRot(theta - abbcAng, abbcOrthoVec);
// llinfos << "abbcAng : " << abbcAng << llendl;
// llinfos << "abbcOrthoVec : " << abbcOrthoVec << llendl;
// llinfos << "agLenSq : " << agLenSq << llendl;
// llinfos << "cosTheta : " << cosTheta << llendl;
// llinfos << "theta : " << theta << llendl;
// llinfos << "bRot : " << bRot << llendl;
// llinfos << "theta abbcAng theta-abbcAng: " << theta*180.0/F_PI << " " << abbcAng*180.0f/F_PI << " " << (theta - abbcAng)*180.0f/F_PI << llendl;
//-------------------------------------------------------------------------
// compute rotation that rotates new A->C to A->G
//-------------------------------------------------------------------------
// rotate B->C by bRot
bcVec = bcVec * bRot;
// update A->C
acVec = abVec + bcVec;
LLQuaternion cgRot;
cgRot.shortestArc( acVec, agVec );
// llinfos << "bcVec : " << bcVec << llendl;
// llinfos << "acVec : " << acVec << llendl;
// llinfos << "cgRot : " << cgRot << llendl;
// update A->B and B->C with rotation from C to G
abVec = abVec * cgRot;
bcVec = bcVec * cgRot;
abcNorm = abcNorm * cgRot;
acVec = abVec + bcVec;
//-------------------------------------------------------------------------
// compute the normal of the APG plane
//-------------------------------------------------------------------------
if (are_parallel(agVec, poleVec, 0.001f))
{
// the solution plane is undefined ==> we're done
return;
}
LLVector3 apgNorm = poleVec % agVec;
apgNorm.normVec();
if (!mbUseBAxis)
{
//---------------------------------------------------------------------
// compute the normal of the new ABC plane
// (only necessary if we're NOT using mBAxis)
//---------------------------------------------------------------------
if( are_parallel(abVec, bcVec, 0.001f) )
{
// G is either too close or too far away
// we'll use the old ABCnormal