next up previous contents index
Next: Drawing Attributes Up: Getting Started Previous: Drawing   Contents   Index

The Camera

Art students sometimes practice perspective by tracing on a window with grease pencil, a mathematical transformation called point projection. ePiX's default mapping from the world to the screen is similar. Imagine standing before a scene at a viewpoint, and possessing X-ray vision, so that objects are transparent. Somewhere in front of you is a plane, the screen. The target is the point on the screen obtained by dropping a perpendicular from the viewpoint.

Three mutually perpendicular unit vectors sit at the target: sea, sky, and eye. The sea vector points to the right, sky points upward, and eye points straight from the target to the viewpoint. The bounding box of the figure is defined with respect to the screen's (Cartesian) sea-sky coordinate system.

Given a point $ p$ in front of the viewpoint, we want to determine the screen location to which $ p$ projects. Join $ p$ to the viewpoint by a line; this line intersects the screen plane exactly once, and the point of intersection is where we draw $ p$ in the screen.

Figure 2.2: Point projection.
\begin{figure}\begin{center}
%%
\input{camera.eepic}
\end{center} \end{figure}

At the start of a figure, the camera is initialized to lie on the $ x_3$-axis at very large distance from the origin. The resulting view, essentially projection along the axis, is suitable for 2-dimensional figures. The camera is manipulated with object-oriented syntax:

  camera.at(P posn);               // set viewpoint to posn
  camera.look_at(P targ);          // set target
  camera.range(double dist);       // fix target, move viewpoint
  camera.focus(double dist);       // fix viewpoint, move target
  camera.rotate_sea(double angle); // rotation about an axis
These commands must come in the figure body.


next up previous contents index
Next: Drawing Attributes Up: Getting Started Previous: Drawing   Contents   Index
Andrew D. Hwang 2004-09-04