3D stuff

Here you can find simple information about simple 3D programs. Unlike the rest of the webpage, this stuff is unchanged. I just couldn't be bothered...

Click here for animated fractal landscapes!


Basic introduction to 3D axis transformations

If you define axes x,y,z then the 3 transformations for rotating about these axes by an angle 't' are (the actual expansions of them really):

X axis rotation:

X = x (unchanged)

Y = y * cos (t) - z * sin (t)

Z = y * sin (t) + z * cos (t)

Y axis rotation:

X = x * cos (t) - z * sin (t)

Y = y (unchanged)

Z = x * sin (t) +z * cos (t)

Z axis rotation:

X = x * cos (t) - y * sin (t)

Y = x * sin (t) + y * cos (t)

Z = z (unchanged)

Those equations are just standard 3*3 matrix transformations expanded out. The 3 sets of equations rotate point (x,y,z) about the axis and give result (X,Y,Z).
These next equations convert point (x,y,z) in (X,Y) for displaying on a monitor.

distance = sqr ( x² + y² + z²)
mag = distance / perspective (perspective is just a constant, and sets the scale of the image)

X = cx + (x / mag)

Y = cy + (y / mag)

where cx = ScreenSizeX / 2 & cy = ScreenSizeY / 2


My programs

3D stars program in Qbasic This is a 3d star field

3D dot cube program in Qbasic This program makes a big 3D cube out of dots and spins it. Also includes information about 3D implementation

Nice wibbly sinewavey type thing This makes a nice wibbly sinewave type thing.