Пример #1
0
        public void GoRight()
        {
            Vector3d fromEyeToRightNorm = new Vector3d(
                ((new HomogeneousCoordinates(eyeTrace.GetAsPoint3D())) * ConversionMatrix.GetRotationY(-Math.PI / 2)).ToPoint3D());

            fromEyeToRightNorm = GetRotatedByAngles(fromEyeToRightNorm).GetNormalize();
            position           = (new Vector3d(position) + (sensForGo * fromEyeToRightNorm)).GetAsPoint3D();
        }
Пример #2
0
        private Vector3d GetRotatedByAngles(Vector3d vec)
        {
            Matrix rotateInVertical   = ConversionMatrix.GetRotationX(angleVisionVertical * (Math.PI / 180));
            Matrix rotateInHorizontal = ConversionMatrix.GetRotationY(angleVisionHorizontal * (Math.PI / 180));
            //сначала поворот вертикально, т.к. горизонтально всегда вокруг Y
            Vector3d res = new Vector3d(
                ((new HomogeneousCoordinates(vec.GetAsPoint3D())) * rotateInVertical).ToPoint3D());

            res = new Vector3d(
                ((new HomogeneousCoordinates(res.GetAsPoint3D())) * rotateInHorizontal).ToPoint3D());
            res = res.GetNormalize();
            return(res);
        }
Пример #3
0
        public void view(SharpGL.OpenGL gl)
        {
            Vector3d viewVector     = GetRotatedByAngles(eyeTrace.GetNormalize());
            Vector3d fromEyeToRight = new Vector3d(
                ((new HomogeneousCoordinates(eyeTrace.GetAsPoint3D())) * ConversionMatrix.GetRotationY(-Math.PI / 2)).ToPoint3D());

            fromEyeToRight = GetRotatedByAngles(fromEyeToRight);
            Vector3d vectorUp = Vector3d.Product(fromEyeToRight, viewVector).GetNormalize();
            Point3D  seeTo    = (new Vector3d(position) + viewVector).GetAsPoint3D();

            gl.LookAt(
                position.x, position.y, position.z,
                seeTo.x, seeTo.y, seeTo.z,
                vectorUp.x, vectorUp.y, vectorUp.z
                );
        }