示例#1
0
        public AngleAxis Divide(float scale)
        {
            AngleAxis aa = this;

            aa.Divide(scale);
            return(aa);
        }
示例#2
0
        public AngleAxis Multiply(float scale)
        {
            AngleAxis aa = this;

            aa.Multiply(scale);
            return(aa);
        }
示例#3
0
        // Combine two rotations (this is VERY costly).
        // @param aa the inner rotation
        // @returns the resulting rotation (like this*q for matrices)
        public AngleAxis Multiply(AngleAxis aa)
        {
            // This is best done as quaternions
            Quaternion q1 = new Quaternion(this);
            Quaternion q2 = new Quaternion(aa);

            return(new AngleAxis(q1.Multiply(q2)));
        }
示例#4
0
        /// <summary>
        /// The angle is recovered as angleaxis = angle and
        /// the axis as axis = angleaxis / angle.
        /// </summary>
        /// <param name="angleaxis">the 3D vector whose size gives the angle and direction </param>
        void Set(AngleAxis angleaxis)
        {
            float x     = angleaxis.GetX();
            float y     = angleaxis.GetY();
            float z     = angleaxis.GetZ();
            float angle = (float)Math.Sqrt(x * x + y * y + z * z);

            if (angle > 0.0)
            {
                float s = (float)Math.Sin(angle / 2.0) / angle;
                float c = (float)Math.Cos(angle / 2.0f);
                _x = s * x;
                _y = s * y;
                _z = s * z;
                _r = c;
            }
            else
            {
                _x = _y = _z = 0.0f;
                _r = 1.0f;
            }
        }
示例#5
0
 public Quaternion(AngleAxis angleaxis)
 {
     Set(angleaxis);
 }
示例#6
0
 /// <summary>
 /// The angle is recovered as angleaxis = angle and
 /// the axis as axis = angleaxis / angle. 
 /// </summary>
 /// <param name="angleaxis">the 3D vector whose size gives the angle and direction </param>        
 void Set(AngleAxis angleaxis)
 {
     float x = angleaxis.GetX();
     float y = angleaxis.GetY();
     float z = angleaxis.GetZ();
     float angle = (float)Math.Sqrt(x*x + y*y + z*z);
     if (angle > 0.0) 
     {
         float s = (float)Math.Sin(angle/2.0)/angle;
         float c = (float)Math.Cos(angle/2.0f);
         _x = s * x;
         _y = s * y;
         _z = s * z;
         _r = c;
     } 
     else 
     {
         _x = _y = _z = 0.0f;
         _r = 1.0f;
     }
 }        
示例#7
0
 public Quaternion(AngleAxis angleaxis)
 {
     Set(angleaxis);
 }
示例#8
0
 public bool NotEqualTo(AngleAxis aa)
 {
     return((aa._x != _x) || (aa._y != _y) || (aa._z != _z));
 }
示例#9
0
 public bool Equals(AngleAxis aa)
 {
     return((aa._x == _x) && (aa._y == _y) && (aa._z == _z));
 }
示例#10
0
 // Combine two rotations (this is VERY costly).
 // @param aa the inner rotation
 // @returns the resulting rotation (like this*q for matrices)
 public AngleAxis Multiply (AngleAxis aa)
 {
     // This is best done as quaternions
     Quaternion q1 = new Quaternion(this);
     Quaternion q2 = new Quaternion(aa);
     return new AngleAxis(q1.Multiply(q2));
 }
示例#11
0
 public bool NotEqualTo (AngleAxis aa)
 {
     return ((aa._x != _x) || (aa._y != _y) || (aa._z != _z));
 }
示例#12
0
 public bool Equals (AngleAxis aa)
 {
     return ((aa._x == _x) && (aa._y == _y) && (aa._z == _z));
 }