Demo-Building - Proetsirvoanie 3D> 2D.

Demo or Die #01
__________________________________________

Wolf of eTc group / Scene



            Projection.



   The mathematical basis of
images of three-dimensional objects on the screen
is to design objects on
two-dimensional plane of the monitor screen.


   We consider three ways of designing
objects:


   1. Dimetricheskaya projection.


                x '= y-x * c;

                y '= z-x * c;


   where x, y, z - three-dimensional coordinates of a point
in space, and x ', y' - two-dimensional
coordinates on the screen. c -
coefficient which is equal to:


   c = sqrt (2) / 2; c = 0.707106781;

   {Sqrt-square root}


   2. Isometric projection.


              x '= (y-x) * c1;

              y '= z-(x + y) / 2;


   where x, y, z - three-dimensional coordinates of a point
in space, and x ', y' - two-dimensional
coordinates on the screen.


   c1 = sqrt (3) / 2; c = 0.866025404;


   3. The view from the camera.


           y z

                /

              /

            /

                     x

         /

       *

     /


   * - The location of the camera.


   Projecting in this location
camera in three dimensions, will
following form:


         x '= x * camera / (x + camera);

         y '= y * camera / (z + camera);


   where x, y, z - three-dimensional coordinates of a point
in space, and x ', y' - two-dimensional
coordinates on the screen.

   camera - camera distance from the beginning
coordinates.


   Naturally all of these modified
coordinates x 'and y' must be put to
coordinates of the center of the screen:


             x '= x' + x_size / 2;

             y '= y' + y_size / 2;


   where x_size - the width of the screen, and y_size -
height.
__________________________________________