Beispiel #1
0
        public void RotatePositionUpDown(double angle)
        {
            Matrix rotateMatrix = ModificationMatrix.GetMoveMatrix(-Target.X, -Target.Y, -Target.Z);

            rotateMatrix = rotateMatrix.Multiply(Position.GetProjectiveCoordinates());
            Position.Set(rotateMatrix[0, 0], rotateMatrix[1, 0], rotateMatrix[2, 0]);

            angle += MathHelp.RadiansToDegrees(Position.Theta);
            angle  = Math.Min(Math.Max(angle, MIN_THETA), MAX_THETA);
            Position.SetTheta(MathHelp.DegreesToRadians(angle));
            AngleTheta = 180 - (int)angle;

            rotateMatrix = ModificationMatrix.GetMoveMatrix(Target.X, Target.Y, Target.Z);
            rotateMatrix = rotateMatrix.Multiply(Position.GetProjectiveCoordinates());
            Position.Set(rotateMatrix[0, 0], rotateMatrix[1, 0], rotateMatrix[2, 0]);
        }
Beispiel #2
0
        public void RotateTargetLeftRight(double angle)
        {
            Matrix rotateMatrix = ModificationMatrix.GetMoveMatrix(-Position.X, -Position.Y, -Position.Z);

            rotateMatrix = rotateMatrix.Multiply(Target.GetProjectiveCoordinates());
            Target.Set(rotateMatrix[0, 0], rotateMatrix[1, 0], rotateMatrix[2, 0]);

            angle += MathHelp.RadiansToDegrees(Target.Phi);
            angle %= 360;
            angle  = angle < 0 ? 360 + angle : angle;

            Target.SetPhi(MathHelp.DegreesToRadians(angle));
            AnglePhi = (int)angle;

            rotateMatrix = ModificationMatrix.GetMoveMatrix(Position.X, Position.Y, Position.Z);
            rotateMatrix = rotateMatrix.Multiply(Target.GetProjectiveCoordinates());
            Target.Set(rotateMatrix[0, 0], rotateMatrix[1, 0], rotateMatrix[2, 0]);
        }
Beispiel #3
0
        public Matrix GetCameraMatrix()
        {
            Matrix matrixInverted = ModificationMatrix.GetMoveMatrix(-Position.X, -Position.Y, -Position.Z);

            Vector3D N = new Vector3D(Target.X - Position.X, Target.Y - Position.Y, Target.Z - Position.Z);
            Vector3D V = new Vector3D(0, 1, 0);
            Vector3D U = V ^ N;

            V = U ^ N;

            U.Normalize();
            V.Normalize();
            N.Normalize();

            cameraMatrix = ModificationMatrix.GetUVNProjectionMatrix(
                U.X, U.Y, U.Z,
                V.X, V.Y, V.Z,
                N.X, N.Y, N.Z);
            cameraMatrix = cameraMatrix.Multiply(matrixInverted);

            return(cameraMatrix);
        }