Beispiel #1
0
CVector3 InterpolateVector(CVector3 vA, CVector3 vB, double blend)
{

   if (blend == 0)
      return vA;
   else if (blend == 1)
      return vB;

   CVector3 cross;
   cross.Cross(vA, vB);
   cross.NormalizeInPlace();

   double lengthA = vA.GetLength();
   double lengthB = vB.GetLength();

   double length = lengthB * blend + lengthA * (1 - blend);

   double a = vA.GetAngle(vB);
   CVector3 v = rotateVectorAlongAxis(vA, cross, a * blend);

   v.NormalizeInPlace();
   v.ScaleInPlace(length);

   return v;
}