next up previous contents index
Next: The Camera Up: Creating and Drawing Objects Previous: Geometric Data Structures   Contents   Index

Drawing

The commands of the previous section create data structures but do not write any output. Each type (other than P) is drawn with ``object-oriented'' syntax. For example, if C1 is a circle, then the command C1.draw() draws the circle. The effect of drawing a plane or sphere is described in Chapter 3. ePiX also provides high-level commands that draw polygons, curves, and compound objects, such as arrows and coordinate axes. Drawing commands must come in the body of the file, after begin().

  line(P p1, P p2);
  triangle(P p1, P p2, P p3);   // vertices specified
  rect(P p1, P p2);             // coord rect w/opposite corners
  quad(P p1, P p2, P p3, P p4); // arbitrary quadrilateral

  spline(P p1, P p2, P p3);     // quad/cubic splines given 
  spline(P p1, P p2, P p3, P p4); // by control points

  arc(P center, radius, t_min, t_max);
  ellipse(P ctr, P v1, P v2, [t_min], [t_max], [int n]);
The arguments of rect must lie in a plane parallel to a coordinate plane; the sides of the rectangle are parallel to coordinate axes.

An arc has the given center and radius, and lies in a plane parallel to the $ (x_1,x_2)$-plane. Angles are measured from the E1 direction in the current angle units.

An ellipse draws an elliptical arc with the specified center and ``axes''; precisely, the curve drawn is parametrized by

$\displaystyle t\mapsto \mathrm{ctr} + (\cos t)v_1 + (\sin t)v_2,\qquad
t_\mathrm{min}\leq t\leq t_\mathrm{max}.
$

(Note that ctr is a location, while v1 and v2 are displacements.) As with arcs, angles are measured in current angle units. If the parameter bounds are omitted, the entire ellipse is drawn. The final (optional) argument says how many points to use when drawing the arc. This can be omitted safely in most situations.


next up previous contents index
Next: The Camera Up: Creating and Drawing Objects Previous: Geometric Data Structures   Contents   Index
Andrew D. Hwang 2004-09-04