Beispiel #1
0
        /// <summary>
        /// Calculate the Rotation Matrix on the Y axis for the given angle
        /// </summary>
        /// <param name="a">Angle</param>
        /// <returns>Return the Rotation Matrix</returns>
        public static Matrix3D GetYRotationMatrix(double a)
        {
            // cos a    0       sin a
            // 0        1       0
            // -sin a   0       cos a
            double cos = AngleUtils.Cos(a);
            double sin = AngleUtils.Sin(a);

            Coordinates3D Row1 = new Coordinates3D(cos, 0, sin);
            Coordinates3D Row2 = new Coordinates3D(0, 1, 0);
            Coordinates3D Row3 = new Coordinates3D(-sin, 0, cos);

            return(new Matrix3D(Row1, Row2, Row3));
        }
Beispiel #2
0
        /// <summary>
        /// Calculate the Rotation Matrix on the Z axis for the given angle
        /// </summary>
        /// <param name="a">Angle</param>
        /// <returns>Return the Rotation Matrix</returns>
        public static Matrix3D GetZRotationMatrix(double a)
        {
            // cos a    - sin a     0
            // sin a    cos a       0
            // 0        0           1
            double cos = AngleUtils.Cos(a);
            double sin = AngleUtils.Sin(a);

            Coordinates3D Row1 = new Coordinates3D(cos, -sin, 0);
            Coordinates3D Row2 = new Coordinates3D(sin, cos, 0);
            Coordinates3D Row3 = new Coordinates3D(0, 0, 1);

            return(new Matrix3D(Row1, Row2, Row3));
        }
Beispiel #3
0
        /// <summary>
        /// Calculate the Rotation Matrix on the X axis for the given angle
        /// </summary>
        /// <param name="a">Angle</param>
        /// <returns>Return the Rotation Matrix</returns>
        public static Matrix3D GetXRotationMatrix(double a)
        {
            // 1    0       0
            // 0    cos a   - sin a
            // 0    sin a   cos a
            double cos = AngleUtils.Cos(a);
            double sin = AngleUtils.Sin(a);

            Coordinates3D Row1 = new Coordinates3D(1, 0, 0);
            Coordinates3D Row2 = new Coordinates3D(0, cos, -sin);
            Coordinates3D Row3 = new Coordinates3D(0, sin, cos);

            return(new Matrix3D(Row1, Row2, Row3));
        }