The most basic drawable object in 3DLDF is
class Point. It is
pair in Metafont. For example, in Metafont one
can define a
pair using the "z" syntax as
z0 = (1cm, 1cm);
There are other ways of defining
pairs in Metafont (and
MetaPost), but this is the usual way.
In 3DLDF, a Point is declared and initialized as follows:
Point pt0(1, 2, 3);
This simple example demonstrates several differences between Metafont
and 3DLDF. First of all, there is no analog in 3DLDF to Metafont's
If I want to have
Points called "
pt2", etc., then I must declare each of them to be a
Point pt0(10, 15, 2); Point pt1(13, 41, 5.5); Point pt2(62.9, 7.02, 8);
Alternatively, I could declare an array of
Now I can refer to
In the Metafont example, the x and y-coordinates of the
are specified using the unit of measurement, in this case, centimeters.
This is currently not possible in 3DLDF. The current unit of
measurement is stored in the static variable
which is a
string. Its default value is
At present, it is best to stick with one unit of measurement for a
After I've defined an input routine, 3DLDF should handle
units of measurement in the same way that Metafont does.
Another difference is that the
pt2 have three coordinates, x, y, and z, whereas
only two, x and y. Actually, the difference goes deeper than this. In
pair has two parts,
which can be examined by the user. In 3DLDF, a
the following sets of coordinates:
world_coordinates user_coordinates view_coordinates projective_coordinates
These are sets of 3-dimensional homogeneous coordinates, which means that they contain four coordinates: x, y, z, and w. Homogeneous coordinates are used in the affine and perspective transformations (see Transforms).
projective_coordinates are used in 3DLDF.
world_coordinates refer to the position of a
3DLDF's basic, unchanging coordinate system.
projective_coordinates are the coordinates of the
two-dimensional projection of the
Point onto a plane.
This projection is what is ultimately printed out or displayed on the
computer screen. Please note, that when the coordinates of a
Point are referred to in this manual, the
world_coordinates are meant, unless otherwise stated.
Points can be declared and their values can be set in different
Point pt0; Point pt1(1); Point pt2(2.3, 52); Point pt3(4.5, 7, 13.205);
pt0 is declared without any arguments, i.e., using the default
constructor, so the values of its x, y, and
z-coordinates are all 0.
pt1 is declared and initialized with one argument for the x-coordinate,
so its y and z-coordinates are initialized with the values of
The latter are static constant data members
Point, whose values are 0 by default. They can be reset
by the user, who should
make sure that they have sensible values.
pt2 is declared and initialized with two arguments for its x and
y-coordinates, so its z-coordinate is initialized to the value of
pt3 has an argument for each of its
Please note that
pt0 is constructed using a the default
constructor, whereas the other
Points are constructed using a
constructor with one required argument (for the x-coordinate), and two
optional arguments (for the y and z-coordinates). The default
constructor always sets all the coordinates to 0, irrespective of the