Points

Specifying points is done through two classes: l3d_point (file point.cc) and l3d_coor-dinate (file coord.h).

The class l3d_point represents a set of four numbers, of the form (x, y, z, w). These numbers represent a location in space in terms of displacements along coordinate axes.

The class l3d_coordinate represents a transformable coordinate location in space. It stores two variables of type l3d_point, named original and transformed. The transformed coordinate is always initialized to equal the original coordinate at the beginning of each frame (method reset), after which it may be transformed by zero or more transformations (method transform). After any number of transformations, the application may choose to save the current location in one of the intermediate storage locations (member transformed_ intermediates), so that the old location may be referenced later. In the end, the transformed coordinate must represent a point in 2D pixel space, since ultimately the points must be used to plot images on-screen. The whole idea is that an l3d_coordinate is more than just a single location in space: it is an original location, a number of optional intermediate locations, and a final location.

The most important thing to remember about the original and transformed members is that the transformed coordinate is the one that is finally used to display the pixels on the screen. An application must at some point put the final pixel coordinates in the transformed member variable.

Was this article helpful?

0 0

Post a comment