Rotater

Compiled by Paul Bourke

Original by Craig Kloeden


Rotater is a program that reads a set of 3-dimensional points and lines and plots them in a window. The image can then be rotated with the mouse in real time. The program takes a file of points as described below.

The input file consists of sets of four points on each line

x y z c

x = x coordinate of a point (real)
y = y coordinate of a point (real)
z = z coordinate of a point (real)
c = colour and/or drawing method (integer)

if (c = 0) move to the x,y,z point without drawing
if (c > 0) draw a line to the x,y,z point from the current
           position using colour c
if (c < 0) draw a dot at x,y,z using colour -c

where
if (c = 1) colour is red
if (c = 2) colour is green
if (c = 3) colour is blue
if (c = 4) colour is yellow
if (c = 5) colour is purple
if (c = 6) colour is cyan
if (c > 6) colour is white

eg
0.5 2.3 -1 0  # moves to point 0.5 2.3 -1 without drawing
3 5 6 2       # draws red line from 0.05 2.3 -1 to 3 5 6
5 -5 2 -3     # plots blue dot at 5 -5 2

The points are automatically scaled to fit in the window and
rotation is about 0,0,0.

The input file can be any text file.
# Comment lines begin with the '#' character.
Text after the four points on a line is ignored.
Completely blank lines are ok (they are ignored).

Contiguous comments at the very start of the file are read in
and displayed in the program in the Info window.
Use this to explain to the user what the image is and where
it comes from. Try to keep it short otherwise the window gets
too big. Internal documentation can be placed in other
comments after a blank line.


The following is an example straight from the Rotater distribution.

# Cube
# by Craig Kloeden 
# This is the standard test image
# It is just the unit cube with different coloured lines

# these lines will not appear in File Comments
# Because of the blank line above

# Initial starting point
1 1 -1 0 This text ignored

# Draw first Face
1 -1 -1 1
-1 -1 -1 1
-1 1 -1 1
1 1 -1 1

1 1 1 3

# Another Face
1 -1 1 2
-1 -1 1 2
-1 1 1 2
1 1 1 2

# Fill in the rest of the lines

-1 -1 -1 0
-1 -1 1 3

-1 1 -1 0
-1 1 1 3

1 -1 -1 0
1 -1 1 3

# The end