next up previous contents index
Next: Path-Like Objects Up: Reference Manual Previous: PSTricks   Contents   Index

The Path Class

A path data structure is ePiX's low-level ordered list of points that can be cropped, clipped, mapped, concatenated, and drawn. Raw path data is useful for complicated paths built in pieces. Available constructors are:

  path(p1, p2);          // line (endpoints)
  path(p1, p2, p3);      // quadratic spline
  path(p1, p2, p3, p4);  // cubic spline
  path(p1, v1, v2, t_min, t_max); // cf. ellipse arc
  path(f, t_min, t_max); // graph or parametrized path

  polyline(n, &p1, ...); // n points, followed by pointers
  polygon(n, &p1, ...);  // same, but marked as closed
The first argument of the parametrized path constructor is a real- or vector-valued function of one variable. In each of the first five constructors, an optional final argument may be supplied to specify the number of points used.

The polyline and polygon constructors accept an unknown number of arguments; consequently, their arguments must be passed as ``pointers'', or memory addresses:

  polyline(2, P(0,0), P(1,1)); // wrong; object arguments

  P p1 = P(0,0), p2=P(1,1);
  polyline(2, &p1, &p2);       // right; pointer arguments
This makes polylines and polygons inconvenient for quick-and-dirty use, but imposes little burden if the vertices have been defined elewhere, as they might be in a logically structured file.

Compound paths may be built by concatenation. If path1 and path2 are paths, then the commands

  path1 += path2;
  path1 -= path2;
replace path1 with the result of traversing path1 ``forward'', then following path2 in the forward or reverse direction (respectively). The notation is meant to suggest 1-dimensional homology chains. The sample file contour.xp illustrates path creation and manipulation. Finally, note that a path is a data structure, not a drawing command. The path::draw() function must be called explicitly to create visible output.



Subsections
next up previous contents index
Next: Path-Like Objects Up: Reference Manual Previous: PSTricks   Contents   Index
Andrew D. Hwang 2004-09-04