Exemple #1
0
        /**
         * @return quaternion with W=0 and V=theta*v.
         */
        public FQuat Log()
        {
            FQuat Result = new UnrealEngine.FQuat();

            Result.W = 0.0f;

            if (FMath.Abs(W) < 1.0f)
            {
                float Angle    = (float)FMath.Acos(W);
                float SinAngle = (float)FMath.Sin(Angle);

                if (FMath.Abs(SinAngle) >= Const.SMALL_NUMBER)
                {
                    float Scale = Angle / SinAngle;
                    Result.X = Scale * X;
                    Result.Y = Scale * Y;
                    Result.Z = Scale * Z;

                    return(Result);
                }
            }

            Result.X = X;
            Result.Y = Y;
            Result.Z = Z;

            return(Result);
        }
Exemple #2
0
 /**
  * get the axis and angle of rotation of this quaternion
  *
  * @param Axis{out] vector of axis of the quaternion
  * @param Angle{out] angle of the quaternion
  * @warning : assumes normalized quaternions.
  */
 public void ToAxisAndAngle(out FVector Axis, out float Angle)
 {
     Angle = (float)(2.0f * FMath.Acos(W));
     Axis  = GetRotationAxis();
 }