Example #1
0
 /// <summary> Sets the value of this axis angle to the value of axis angle a1.</summary>
 /// <param name="a1">the axis angle to be copied
 /// </param>
 public void  set_Renamed(AxisAngle4d a1)
 {
     this.x     = a1.x;
     this.y     = a1.y;
     this.z     = a1.z;
     this.angle = a1.angle;
 }
Example #2
0
        /// <summary> Returns true if the L-infinite distance between this axis-angle
        /// and axis-angle a1 is less than or equal to the epsilon parameter,
        /// otherwise returns false.  The L-infinite
        /// distance is equal to
        /// MAX[abs(x1-x2), abs(y1-y2), abs(z1-z2), abs(angle1-angle2)].
        /// </summary>
        /// <param name="a1"> the axis-angle to be compared to this axis-angle
        /// </param>
        /// <param name="epsilon"> the threshold value
        /// </param>
        public virtual bool epsilonEquals(AxisAngle4d a1, double epsilon)
        {
            double diff;

            diff = x - a1.x;
            if ((diff < 0?-diff:diff) > epsilon)
            {
                return(false);
            }

            diff = y - a1.y;
            if ((diff < 0?-diff:diff) > epsilon)
            {
                return(false);
            }

            diff = z - a1.z;
            if ((diff < 0?-diff:diff) > epsilon)
            {
                return(false);
            }

            diff = angle - a1.angle;
            if ((diff < 0?-diff:diff) > epsilon)
            {
                return(false);
            }

            return(true);
        }
Example #3
0
		/// <summary> Constructs and initializes an AxisAngle4d from the specified AxisAngle4d.</summary>
		/// <param name="a1">the AxisAngle4d containing the initialization x y z angle data
		/// </param>
		public AxisAngle4d(AxisAngle4d a1)
		{
			this.x = a1.x;
			this.y = a1.y;
			this.z = a1.z;
			this.angle = a1.angle;
		}
Example #4
0
 /// <summary> Constructs and initializes an AxisAngle4d from the specified AxisAngle4d.</summary>
 /// <param name="a1">the AxisAngle4d containing the initialization x y z angle data
 /// </param>
 public AxisAngle4d(AxisAngle4d a1)
 {
     this.x     = a1.x;
     this.y     = a1.y;
     this.z     = a1.z;
     this.angle = a1.angle;
 }
Example #5
0
        /// <summary> Sets the value of this quaternion to the equivalent rotation
        /// of the AxisAngle argument.
        /// </summary>
        /// <param name="a"> the AxisAngle to be emulated
        /// </param>
        public void  set_Renamed(AxisAngle4d a)
        {
            float mag, amag;

            // Quat = cos(theta/2) + sin(theta/2)(roation_axis)

            //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
            amag = (float)(1.0 / System.Math.Sqrt(a.x * a.x + a.y * a.y + a.z * a.z));

            if (amag < EPS)
            {
                w = 0.0f;
                x = 0.0f;
                y = 0.0f;
                z = 0.0f;
            }
            else
            {
                amag = 1.0f / amag;
                //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
                mag = (float)System.Math.Sin(a.angle / 2.0);
                //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
                w = (float)System.Math.Cos(a.angle / 2.0);
                //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
                x = (float)a.x * amag * mag;
                //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
                y = (float)a.y * amag * mag;
                //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
                z = (float)a.z * amag * mag;
            }
        }
Example #6
0
 /// <summary> Constructs and initializes an AxisAngle4f from the specified AxisAngle4d.</summary>
 /// <param name="a1">the AxisAngle4d containing the initialization x y z angle data
 /// </param>
 public AxisAngle4f(AxisAngle4d a1)
 {
     //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
     this.x = (float)a1.x;
     //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
     this.y = (float)a1.y;
     //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
     this.z = (float)a1.z;
     //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
     this.angle = (float)a1.angle;
 }
Example #7
0
 /// <summary> Returns true if all of the data members of AxisAngle4d a1 are
 /// equal to the corresponding data members in this AxisAngle4d.
 /// </summary>
 /// <param name="a1"> the axis-angle with which the comparison is made
 /// </param>
 /// <returns>  true or false
 /// </returns>
 public bool equals(AxisAngle4d a1)
 {
     try
     {
         return(this.x == a1.x && this.y == a1.y && this.z == a1.z && this.angle == a1.angle);
     }
     catch (System.NullReferenceException e2)
     {
         return(false);
     }
 }
Example #8
0
 /// <summary> Returns true if the Object o1 is of type AxisAngle4d and all of the
 /// data members of o1 are equal to the corresponding data members in
 /// this AxisAngle4d.
 /// </summary>
 /// <param name="o1"> the object with which the comparison is made
 /// </param>
 /// <returns>  true or false
 /// </returns>
 public override bool Equals(System.Object o1)
 {
     try
     {
         AxisAngle4d a2 = (AxisAngle4d)o1;
         return(this.x == a2.x && this.y == a2.y && this.z == a2.z && this.angle == a2.angle);
     }
     catch (System.NullReferenceException e2)
     {
         return(false);
     }
     catch (System.InvalidCastException e1)
     {
         return(false);
     }
 }
Example #9
0
        /// <summary> Sets the value of this quaternion to the equivalent rotation
        /// of the AxisAngle argument.
        /// </summary>
        /// <param name="a"> the AxisAngle to be emulated
        /// </param>
        public void  set_Renamed(AxisAngle4d a)
        {
            double mag, amag;

            // Quat = cos(theta/2) + sin(theta/2)(roation_axis)

            amag = System.Math.Sqrt(a.x * a.x + a.y * a.y + a.z * a.z);
            if (amag < EPS)
            {
                w = 0.0;
                x = 0.0;
                y = 0.0;
                z = 0.0;
            }
            else
            {
                amag = 1.0 / amag;
                mag  = System.Math.Sin(a.angle / 2.0);
                w    = System.Math.Cos(a.angle / 2.0);
                x    = a.x * amag * mag;
                y    = a.y * amag * mag;
                z    = a.z * amag * mag;
            }
        }
Example #10
0
		/// <summary> Sets the value of this matrix to the matrix conversion of the
		/// single precision axis and angle argument. 
		/// </summary>
		/// <param name="a1">the axis and angle to be converted 
		/// </param>
		public void  set_Renamed(AxisAngle4d a1)
		{
			setFromAxisAngle(a1.x, a1.y, a1.z, a1.angle);
		}
Example #11
0
		/// <summary> Sets the value of this matrix to the matrix conversion of the
		/// double precision axis and angle argument.
		/// </summary>
		/// <param name="a1">the axis and angle to be converted
		/// </param>
		public void  set_Renamed(AxisAngle4d a1)
		{
			double mag = Math.Sqrt(a1.x * a1.x + a1.y * a1.y + a1.z * a1.z);
			
			if (mag < EPS)
			{
				m00 = 1.0;
				m01 = 0.0;
				m02 = 0.0;
				
				m10 = 0.0;
				m11 = 1.0;
				m12 = 0.0;
				
				m20 = 0.0;
				m21 = 0.0;
				m22 = 1.0;
			}
			else
			{
				mag = 1.0 / mag;
				double ax = a1.x * mag;
				double ay = a1.y * mag;
				double az = a1.z * mag;
				
				double sinTheta = Math.Sin(a1.angle);
				double cosTheta = Math.Cos(a1.angle);
				double t = 1.0 - cosTheta;
				
				double xz = a1.x * a1.z;
				double xy = a1.x * a1.y;
				double yz = a1.y * a1.z;
				
				m00 = t * ax * ax + cosTheta;
				m01 = t * xy - sinTheta * az;
				m02 = t * xz + sinTheta * ay;
				
				m10 = t * xy + sinTheta * az;
				m11 = t * ay * ay + cosTheta;
				m12 = t * yz - sinTheta * ax;
				
				m20 = t * xz - sinTheta * ay;
				m21 = t * yz + sinTheta * ax;
				m22 = t * az * az + cosTheta;
			}
		}
Example #12
0
		/// <summary> Constructs and initializes an AxisAngle4f from the specified AxisAngle4d.</summary>
		/// <param name="a1">the AxisAngle4d containing the initialization x y z angle data
		/// </param>
		public AxisAngle4f(AxisAngle4d a1)
		{
			//UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
			this.x = (float) a1.x;
			//UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
			this.y = (float) a1.y;
			//UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
			this.z = (float) a1.z;
			//UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
			this.angle = (float) a1.angle;
		}
Example #13
0
		/// <summary> Sets the rotational component (upper 3x3) of this matrix to the matrix
		/// equivalent values of the axis-angle argument; the other elements of this
		/// matrix are unchanged; a singular value decomposition is performed on
		/// this object's upper 3x3 matrix to factor out the scale, then this
		/// object's upper 3x3 matrix components are replaced by the matrix
		/// equivalent of the axis-angle, and then the scale is reapplied to the
		/// rotational components.
		/// </summary>
		/// <param name="a1">the axis-angle to be converted (x, y, z, angle)
		/// </param>
		public void  setRotation(AxisAngle4d a1)
		{
			double scale = SVD(null, null);
			// save other values
			double tx = m03;
			double ty = m13;
			double tz = m23;
			double w0 = m30;
			double w1 = m31;
			double w2 = m32;
			double w3 = m33;
			
			set_Renamed(a1);
			mulRotationScale(scale);
			
			// set back
			m03 = tx;
			m13 = ty;
			m23 = tz;
			m30 = w0;
			m31 = w1;
			m32 = w2;
			m33 = w3;
		}
Example #14
0
		/// <summary> Sets the value of this quaternion to the equivalent rotation
		/// of the AxisAngle argument.
		/// </summary>
		/// <param name="a"> the AxisAngle to be emulated
		/// </param>
		public void  set_Renamed(AxisAngle4d a)
		{
			double mag, amag;
			// Quat = cos(theta/2) + sin(theta/2)(roation_axis) 
			
			amag = System.Math.Sqrt(a.x * a.x + a.y * a.y + a.z * a.z);
			if (amag < EPS)
			{
				w = 0.0;
				x = 0.0;
				y = 0.0;
				z = 0.0;
			}
			else
			{
				amag = 1.0 / amag;
				mag = System.Math.Sin(a.angle / 2.0);
				w = System.Math.Cos(a.angle / 2.0);
				x = a.x * amag * mag;
				y = a.y * amag * mag;
				z = a.z * amag * mag;
			}
		}
Example #15
0
		/// <summary> Sets the value of this quaternion to the equivalent rotation
		/// of the AxisAngle argument.
		/// </summary>
		/// <param name="a"> the AxisAngle to be emulated
		/// </param>
		public void  set_Renamed(AxisAngle4d a)
		{
			float mag, amag;
			// Quat = cos(theta/2) + sin(theta/2)(roation_axis) 
			
			//UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
			amag = (float) (1.0 / System.Math.Sqrt(a.x * a.x + a.y * a.y + a.z * a.z));
			
			if (amag < EPS)
			{
				w = 0.0f;
				x = 0.0f;
				y = 0.0f;
				z = 0.0f;
			}
			else
			{
				amag = 1.0f / amag;
				//UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
				mag = (float) System.Math.Sin(a.angle / 2.0);
				//UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
				w = (float) System.Math.Cos(a.angle / 2.0);
				//UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
				x = (float) a.x * amag * mag;
				//UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
				y = (float) a.y * amag * mag;
				//UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
				z = (float) a.z * amag * mag;
			}
		}
Example #16
0
		/// <summary> Sets the value of this axis angle to the value of axis angle a1.</summary>
		/// <param name="a1">the axis angle to be copied
		/// </param>
		public void  set_Renamed(AxisAngle4d a1)
		{
			this.x = a1.x;
			this.y = a1.y;
			this.z = a1.z;
			this.angle = a1.angle;
		}
Example #17
0
		/// <summary> Returns true if the L-infinite distance between this axis-angle
		/// and axis-angle a1 is less than or equal to the epsilon parameter, 
		/// otherwise returns false.  The L-infinite
		/// distance is equal to 
		/// MAX[abs(x1-x2), abs(y1-y2), abs(z1-z2), abs(angle1-angle2)].
		/// </summary>
		/// <param name="a1"> the axis-angle to be compared to this axis-angle 
		/// </param>
		/// <param name="epsilon"> the threshold value  
		/// </param>
		public virtual bool epsilonEquals(AxisAngle4d a1, double epsilon)
		{
			double diff;
			
			diff = x - a1.x;
			if ((diff < 0?- diff:diff) > epsilon)
				return false;
			
			diff = y - a1.y;
			if ((diff < 0?- diff:diff) > epsilon)
				return false;
			
			diff = z - a1.z;
			if ((diff < 0?- diff:diff) > epsilon)
				return false;
			
			diff = angle - a1.angle;
			if ((diff < 0?- diff:diff) > epsilon)
				return false;
			
			return true;
		}
Example #18
0
		/// <summary> Returns true if all of the data members of AxisAngle4d a1 are
		/// equal to the corresponding data members in this AxisAngle4d.
		/// </summary>
		/// <param name="a1"> the axis-angle with which the comparison is made
		/// </param>
		/// <returns>  true or false
		/// </returns>
		public bool equals(AxisAngle4d a1)
		{
			try
			{
				return (this.x == a1.x && this.y == a1.y && this.z == a1.z && this.angle == a1.angle);
			}
			catch (System.NullReferenceException e2)
			{
				return false;
			}
		}