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 in front of the viewpoint, we want to determine the
screen location to which
projects. Join
to the viewpoint by a
line; this line intersects the screen plane exactly once, and the
point of intersection is where we draw
in the screen.
At the start of a figure, the camera is initialized to lie on the
-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 axisThese commands must come in the figure body.