|Just another Perl shrine|
Re: 3D Point Plottingby Merlin42 (Friar)
|on May 28, 2002 at 16:12 UTC||Need Help??|
I know you asked for a module, but this can be done very simply .. as long as you only want to do simple stuff :).
If you are only interested in doing 3d points and have a static projective camera pointed along the Z axis then you can use the old 'divide by Z' trick. This is what is used in the classic 'flying stars/windows' screen saver. Lets say you are interested in veiwing some points inside a 3d cube of dimensions x1 to x2 by y1 to y2 by z1 to inf
for each point x,y,z
plot Xviewport,Yviewport into the bitmap
NOTE: This is off the top of my head so it might be utter jiberish
NOTE: You could add one step b4 the cull/clip to transform your points so that they can be viewed along the z axis. This can be done w/ a 3x3 matrix multiply and a vector add(or with a 4x4 matrix mult ala OpenGL).
NOTE: If you prescale Z by some factor you can get different "zooms"
NOTE: If you want an orthographic projection, more like engineering diagrams/bluerpints then just skip all the divides and just thow away Z.