Esempio n. 1
0
        public static Matrix rotateMatrix(float dx, float dy, float dz)
        // matrix for rotation
        {
            var   result = new Matrix(true);
            float SIN;
            float COS;

            if (dx != 0)
            {
                var m = new Matrix(true);
                SIN   = MathUtility.Sin(dx);
                COS   = MathUtility.Cos(dx);
                m.m11 = COS;
                m.m12 = SIN;
                m.m21 = -SIN;
                m.m22 = COS;
                result.transform(m);
            }
            if (dy != 0)
            {
                var m = new Matrix(true);
                SIN   = MathUtility.Sin(dy);
                COS   = MathUtility.Cos(dy);
                m.m00 = COS;
                m.m02 = SIN;
                m.m20 = -SIN;
                m.m22 = COS;
                result.transform(m);
            }
            if (dz != 0)
            {
                var m = new Matrix(true);
                SIN   = MathUtility.Sin(dz);
                COS   = MathUtility.Cos(dz);
                m.m00 = COS;
                m.m01 = SIN;
                m.m10 = -SIN;
                m.m11 = COS;
                result.transform(m);
            }
            return(result);
        }
Esempio n. 2
0
 /// <summary>
 /// Builds the cartesian coordinates out of the given cylindric coordinates.
 /// </summary>
 public void BuildCartesian()
 {
     X = R * MathUtility.Cos(Theta);
     Y = R * MathUtility.Sin(Theta);
 }