3d without 3d :-)

Hey. I like to add some fake 3D feature to my PenPlotter Library. How can i solve the Problem.

Example. I got a cube with x,y and z coordinate. I must translate these values into x and y Values. How can i translate the z coordinate into a x,y coordinate?

Another Example. i got a 3D line--> line(10,10,100,50,70,400); How can i translate the z coordinates in x,y coordinates that it looks like the "normal" 3D Line...........

Answers

  • maths.

    you have a choice of projection. the simplest is just dropping the z coordinate.

    but you probably want "perspective transformation". in its simplest form it's just

    x1 = x / z; y1 = y / z;

    (where x, y and z are inputs, x1 and y1 are outputs. this will break when z = 0, obviously).

Sign In or Register to comment.