Exemplo n.º 1
0
        public AngleAxis Divide(float scale)
        {
            AngleAxis aa = this;

            aa.Divide(scale);
            return(aa);
        }
Exemplo n.º 2
0
        public AngleAxis Multiply(float scale)
        {
            AngleAxis aa = this;

            aa.Multiply(scale);
            return(aa);
        }
Exemplo n.º 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)));
        }
Exemplo n.º 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;
            }
        }
Exemplo n.º 5
0
 public Quaternion(AngleAxis angleaxis)
 {
     Set(angleaxis);
 }
Exemplo n.º 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;
     }
 }        
Exemplo n.º 7
0
 public Quaternion(AngleAxis angleaxis)
 {
     Set(angleaxis);
 }
Exemplo n.º 8
0
 public bool NotEqualTo(AngleAxis aa)
 {
     return((aa._x != _x) || (aa._y != _y) || (aa._z != _z));
 }
Exemplo n.º 9
0
 public bool Equals(AngleAxis aa)
 {
     return((aa._x == _x) && (aa._y == _y) && (aa._z == _z));
 }
Exemplo n.º 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));
 }
Exemplo n.º 11
0
 public bool NotEqualTo (AngleAxis aa)
 {
     return ((aa._x != _x) || (aa._y != _y) || (aa._z != _z));
 }
Exemplo n.º 12
0
 public bool Equals (AngleAxis aa)
 {
     return ((aa._x == _x) && (aa._y == _y) && (aa._z == _z));
 }