next up previous contents index
Next: Geometric Data Structures Up: The Path Class Previous: The Path Class   Contents   Index

Path-Like Objects

Path-like objects comprise polygons with a fixed number of vertices (lines, triangles, quadrilaterals) and objects built from them (including coordinate axes, grids, and arrows); curves with a variable number of points (ellipses, arcs, splines); and plots of functions of one variable.

Fixed-data polygons are drawn with high-level commands.

  line(p1, p2);
  triangle(p1, p2, p3);
  quad(p1, p2, p3, p4);
  rect(p1, p2);             // coordinate rectangle
  spline(p1, p2, p3);       // quad spline with control pts
  spline(p1, p2, p3, p4);   // cubic spline
A line() accepts an optional numerical argument that acts as an expansion parameter: line(p1,p2,t); draws a segment with midpoint at the midpoint of p1 and p2, but having length scaled by $ 2^{t/100}$. (That is, $ t=100$ doubles the length, while $ t=-100$ halves the length.) The arguments of rect() must lie in a plane parallel to a coordinate plane.

Internally, ePiX marks paths as closed or not; triangles, quadrilaterals, polygons, ellipses, and arrows are closed. If a solid, closed path is drawn while filling is active, the path is filled with the current shade of gray. If filling is deactivated, the path is drawn but not filled. Dashed and dotted paths cannot be filled in one step; instead, fill the solid path, then draw the dashed/dotted boundary.

The shade of gray is a number between 0 (white) and 1 (black), and defaults to 0.3. Shading is opaque in PostScript, so the order of figure elements is significant in the input file when filling is active.

Color filling is available only through PSTricks. The features of PSTricks that are relatively well-supported in ePiX are illustrated in the sample file contour.xp. In principle, any PSTricks features can be obtained through raw output. However, this approach is generally discouraged since, for example, PSTricks color declarations are not recognized by eepic, and vice-versa. The Next Generation of ePiX will work more seamlessly with PSTricks.

Elliptical arcs are specified by their center, a pair of vectors, an angular range, and an optional number of points:

  ellipse(ctr, v1, v2, t_min, t_max, n);
uses $ n+1$ points to draw the parametrized path

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

If omitted, the number of points defaults to 80 for a full turn, with proportionally fewer points for an arc. When the angular range subtends one or more full turns, the ellipse is marked as closed, and will be filled if filling is active.

The circular arc parallel to the $ (x_1,x_2)$-plane, having center $ p_1$ and radius $ r$, and subtending the angle (counterclockwise, in current angle units) from $ \theta_1$ to $ \theta_2$ is drawn with

  arc(p1, r, theta1, theta2);
  arc_arrow(p1, r, theta1, theta2); // same, with arrowhead
If $ \theta_2$ is smaller, the arc goes clockwise. The arrowhead goes at $ \theta_2$. If an arc_arrow is too short, nothing is drawn.


next up previous contents index
Next: Geometric Data Structures Up: The Path Class Previous: The Path Class   Contents   Index
Andrew D. Hwang 2004-09-04