NL EN Main | Penguins | Projects | Travel | Photos | Publications | SensorWiki

3D Wireframes

The pictures on this page can be viewed with a green/red pair of glasses. The right eye is covered with a green foil. Therefore, it can not see the green lines, while the red lines become dark. With the red foil in front of the left eye, the red lines become invisible and the green lines become almost black.

Calculating the projection of a 3D object to the sceen

It is quite easy to calculate the 3D projection of a wireframe onto the computer screen. First we reduce the problem to the 2-dimensional plane in which the eyes are located, perpendicular to the computer sceen.

The point (x, z) of the source object is indicated by (xs, zs) while the location of the observer is indicated by (xo, zo).

Off course, there are two eyes. We have to apply similar projections for the left and right eye. For simplicity, the equations are given here for a single eye. The only thing that changes is the x-position of the second eye.

For the following argumentation it does not matter if the object is in front or behind the computer screen.


The projection of the source point (xs, zs) on the sceen is (xp) and can be found by the intersection of the line from (xs, zs) to (xo, zo) with the screen. Two congruent triangles result into the equation

which can easily be modified into

.

The same as we did for the xz-plane is valid for the yz-plane. The equation becomes

.

Normally we fix the position of the eyes and say xo-left=-d/2 and xo-right=d/2 with d the distance between the eyes (approximately 6 cm). In addition, the mutual yo-position of the eyes can be set to 0 and the distance zo to the screen to -l (negative!). However, in that case we can not simply make the viewer virtually move with respect to the object (although this is a relative thing).

These equations are implemented in MathCad 6.0 including some functions to generate wireframes for common shapes.

Viewing the files

Each wire consists of four points: two for a left-eye wire and two for the righ-eye wire. The MathCad worksheet generates ASCII files with eight numbers per line. The meaning of the numbers is: x1-left, y1-left, x2-left, y2-left, x1-right, y1-right, x2-right, y2-right.

A simple file viewer was programmed which can read the .prn ASCII files and view them on the screen. At this moment, the numbers in the file must be separted by spaces and only fractional numbers (no exponents) can be used.

Some examples



back



back



back



back