The simplest object in the world is a point, represented by an ordered
triple of real numbers (double-precision floats). The
function P(x1,x2,x3) creates the point
. If only
two arguments are provided,
by default. This convention allows
ePiX to treat 2- and 3-dimensional figures uniformly. Often points
are given names, so they can be used repeatedly throughout a figure.
The (essentially equivalent) commands
P pt(x_min, 2*x_min, 4); P pt = P(x_min, 2*x_min, 4);create a point named pt and initialize it to
Points can be given in polar, cylindrical, or spherical coordinates; all arguments are numerical.
P pt=polar(r, t); // (r*Cos(t), r*Sin(t)) P pt=cyl(r, t, z); // (r*Cos(t), r*Sin(t), z) P pt=sph(r, t, phi);The arguments of sph are radius (distance to the origin), longitude (measured from the
ePiX provides algebraic operations on triples, including addition, scalar multiplication, the dot and cross products, and a few others. These operations are used to express relationships between triples, as in
P p1(2,1), p2(-3,1); P q1 = p1-p2, q2 = 2*p1-3*p2, q3=q1*q2;The points
Practically, ordered triples of numbers are used to represent both locations (points) and displacements (vectors). Mathematically, the concepts are distinct; for example, it makes geometric sense to add two displacements (obtaining a displacement), or to add a displacement to a location (to get a location), but two locations cannot be added meaningfully. Algebraic operations act on vectors, not points. ePiX does not enforce the distinction between points and vectors, but will in The Next Generation.
ePiX implements data structures that represent line segments, circles, planes, and spheres. These structures can be translated, scaled, and intersected. A code snippet illustrates basic techniques:
circle C1(P(0,1), P(0,-1), P(0.5,0)); // circle through 3 pts C1 += P(0.1,0); // translate center C1 *= 2; // double the radius sphere S1(P(0,0,0), 1.5); // sphere of radius 1.5 at origin plane P1(P(0,0,0), E_3); // (x,y)-plane circle C2 = S1*P1; // circle of intersectionUse of these data structures is explained in more detail in Chapter 3.