Ivor,

You already know to go from 3D to 2D you just loose one axis

(say z)

X = x

Y = y

ignore z.

To Rotate:

SUB rotate (a, b, c, xrotate, yrotate, zrotate)

rad = 3.14159 / 180

x0 = x

y0 = y

z0 = z

x1 = x0

y1 = y0 * COS(xrotate * rad) - z0 * SIN(xrotate * rad)

z1 = y0 * SIN(xrotate * rad) + z0 * COS(xrotate * rad)

x2 = z1 * SIN(yrotate * rad) + x1 * COS(yrotate * rad)

y2 = y1

z2 = z1 * COS(yrotate * rad) - x1 * SIN(yrotate * rad)

x3 = x2 * COS(zrotate * rad) - y2 * SIN(zrotate * rad)

y3 = x2 * SIN(zrotate * rad) + y2 * COS(zrotate * rad)

z3 = z2

x = x3

y = y3

z = z3

END SUB

Perspective is handled by dividing by the axis you dropped.

newX = f*x/z

newY = f*y/z

where f sets the amount of perspective. You may have to

Translate your dataset away on this dropped axis so that you don't

flip points.

Jeff

Quote:

> Is it possible to write some code in

Visual Basic to draw a scatterplot

> with 3 axis and then rotate it. There are some fancy statistics

> packages that will do it but they don't do quite what I want. Has

> anybody written some code already or do I have to start from scratch? I

> have tried hunting all over the web and in various newsgroups and come

> up with naught.

> Any tips appreciated