A projection technique, used for representing three-dimensional objects in two-dimensions; in other words, **axonometry** allows you to make drawings of solid objects.

Axonometry is normally opposed to **perspective**, but is actually a **form** of perspective where the viewing point is placed at an infinite distance from the object.

In axonometry the 3d coordinates can be transformed into 2d coordinates with simple linear transformations. This is also why axonometry is used for technical drawings; it is easy to relate the 3d drawing with the measurements that a worker will need to actually build the thing.

Axonometry takes different forms, usually defined by the angles of the axes in the drawing. For example, this drawing of a cube:

`
|`**z** /**y**
| /
| O-----/------O
/|.........../|
| /.|.../....../.|
/..|........./..|
O---|-/------O...|
|...|........|...|
|...o------------O
|../.........|../
|./..........|./
|/...........|/ **x**
----O------------O - - - - - - - - - - - -

has (or should have, depending on your fonts) a 90 degree angle between the horizontal and the z axis, a 45 degree angle between z and y, and a 45 degree angle between y and x. In this form of axonometry, the transformation is:

X = x + y/2

Y = z + y/2

Now, ASCII is really the *wrong* medium for this kind of explanation, so I will not attempt more diagrams. Let us just say that there are other forms of axonometry where the angles are different; an important one is **isometric axonometry** where the angles are 45, 90 and 45, and the transformation conserves the shape and size of the top view (while horribly distorting the side views).

There is a good page about axonometry at `http://www.compuphase.com/axometr.htm`.

Axonometry is used in Chinese scroll paintings, and it is precisely the technique that allows them to be many meters long. It is also used in computer games, because it is much faster to computer than other forms of perspective.

As an example, I will include the following Design by Numbers code that defines a small axonometry library and then exercises it by drawing a pyramid.

`// Dimetric Axonometry
// read about this and other projections at:
// http://www.compuphase.com/axometr.htm
//
// a way to project three-dimensional points in two-dimensional space
//
// improvised in class to improve our pyramids
//
// Author: baffo
// Started on: 29 11 2001
//
// Note: our axonometry is of the type where
// X = x + y/2
// Y = z + y/2
// the y axis is at 45 degrees with the x and z axis
// a reasonable size
size 300 300
// due to horrible DBN bug, I must repeat this number here.
set totsize 300
// *** CONVERTING 3D POINTS TO 2D COORDINATES
// produce 2d y coordinate from three dimensional point
number y2d x y z
{
value (z + (y/2))
}
// produce 3d y coordinate from three dimensional point
number x2d x y z
{
value (x + (y/2))
}
// If you used these formulas, you would get a different projection
// value (z + (y/3) + (x/3))
// value (((2*x)/3) - ((2*y)/3 ) + 100 )
// ** DRAWING A 3D LINE
// USES: x2d y2d
// use point coordinate conversions for drawing a line between two 3d points
command line3d x1 y1 z1 x2 y2 z2
{
line <x2d x1 y1 z1> <y2d x1 y1 z1> <x2d x2 y2 z2> <y2d x2 y2 z2>
}
// draw a bunch of 8 3d lines (that's to say, a thicker line)
command thickline3d x1 y1 z1 x2 y2 z2
{
repeat x 0 1
{
repeat y 0 1
{
repeat z 0 1
{
line3d (x1+x) (y1+y) (z1+z) (x2+x) (y2+y) (z2+z)
}
}
}
}
// ** DRAWING A REFERENCE GRID IN SPACE
// draw a reference grid in three dimensional space
// step specifies the size of the square in the grid
// USES: line3d
command drawBackgroundGrid step
{
pen 20
set stepsX (totsize/step)
repeat n 0 stepsX
{
set coord (n*step)
// looks complex, it is just six lines on the faces of the cube
line3d coord 0 0 coord totsize 0
line3d coord totsize 0 coord totsize totsize
line3d 0 coord 0 totsize coord 0
line3d 0 coord 0 0 coord totsize
line3d 0 0 coord 0 totsize coord
line3d 0 totsize coord totsize totsize coord
}
}
// EXAMPLE CODE: draw a more or less transparent pyramid
// reasonable sizes for a pyramid
set B 180
set A 20
set TOP ((B+A)/2)
//decorate space
drawBackgroundGrid 17
//fill in faces, not completely (so that some of the background shows through)
repeat n A B
{
same? (n%3) 1
{
pen (20+n/3)
line3d A n A TOP TOP B
line3d B n A TOP TOP B
line3d n A A TOP TOP B
line3d n B A TOP TOP B
}
}
//draw edges
pen 100 0 0
thickline3d A A A B A A
thickline3d B A A B B A
thickline3D B B A A B A
thickline3d A B A A A A
thickline3d A A A TOP TOP B
thickline3d B A A TOP TOP B
thickline3D B B A TOP TOP B
thickline3d A B A TOP TOP B
//project the base of the pyramid on the plane (just for making it look cooler)
line3d A A 0 B A 0
line3d B A 0 B B 0
line3D B B 0 A B 0
line3d A B 0 A A 0
//that's all folks!
`

*this was developed in the context of the Computer Science for Smart People course*