[comp.graphics] 3d continued

js9b+@andrew.cmu.edu (Jon C. Slenk) (11/23/88)

Ok, all, this is another part of the 3d program / hack. I am waiting and willing to hear from all you about what needs to be added/changed. Are there any PD 3d
programs? This could become a decent one, if we all work on it.

Email me if you want to talk. If you have something useful to add, might as well post it to the bboard.


Sincerely,
Jon Slenk / js9b CMU (actually Carnegie Mellon Inc :-))
        Ok, here comes the next installment in the on-going 'discussion' of 3
dimentional graphics. This one outlines some further improvements in the
structure of our PASCAL program.



        We must have nice, clean data structures. To do this, we can set up a
structure which holds two linked lists: one of the points of an object, and
one of the edges (defined by '1,2' indicating connect point one and two
etc.). This structure, since it is of variable length, allows us to use it to
define any other structure.

        IE: the structure says


        PointerType:PointList^;



        PointList=     Record

               x,y,z:Integer;

               next:PointerType;


        EdgeList=      Record

               point1,point2:Integer;



        DataStrucutre= Record

               PointList:Points;
               EdgeList:Edges;



        The points are defined as are the edges. To draw the image, we send
the points to be connected to the drawing routines, which convert from 3
to 2d and draw the appropriate lines.

        Our program has procedures as follows:
        Procedure Translate (Var x,y,x:Integer);



        Procedure Rotatex (angle:Real; Var y,z:Integer);

        Procedure Rotatey (angle:Real; Var x,z:Integer);

        Procedure Rotatez (angle:Real; Var y,x:Integer);

        Procedure RotateDataStructure (anglex,angley,anglez,DataType);


        Procedure DrawLineTo (x,y,z:Integer);

        Procedure DrawLine (x,y,z,x1,y1,z1:Integer);

        Procedure MoveOffset (x,y,z:Integer);

        Procedure MoveAbsolute (x,y,z:Integer);
        Hidden in the Draw and Move routines are converters to 2d.



        I believe this may be the beginning of a decent program. Any
comments, ie constructive criticism, would be greatly appreciated. Email
or post to the board if they are of substantial use/importance.



Sincerely,
Jon Slenk / js9b andrew.cmu.edu