/* -*-ePiX-*- */ #include "epix.h" using namespace ePiX; const double MAX(2.5); const double XMIN(-2); // twisted cubic P cubic(double t) { return t*P(1, t, t*t); } // projections to coordinate planes P cubic12(double t) { const P arg(cubic(t)); return P(arg.x1(), arg.x2(), XMIN); } P cubic13(double t) { const P arg(cubic(t)); return P(arg.x1(), XMIN, arg.x3()); } P cubic23(double t) { const P arg(cubic(t)); return P(XMIN, arg.x2(), arg.x3()); } // draw lines from one path to another void bars(P f1(double), P f2(double)) { for (int i=0; i<=20; ++i) line(f1(-1+0.1*i), f2(-1+0.1*i)); } // code to draw entire figure void draw_frame() { // (x,z)-plane blue(); bbold(); plot(cubic13, -1, 1, 60); plain(); bars(cubic13, cubic); label(cubic13(1), P(0,2), "\$x\$-\$z\$", t); // (y,z)-plane green(0.6); bbold(); plot(cubic23, -1, 1, 60); plain(); bars(cubic23, cubic); label(cubic23(1), P(0,2), "\$y\$-\$z\$", t); // (x,y)-plane magenta(); bbold(); plot(cubic12, -1, 1, 60); plain(); bars(cubic12, cubic); label(cubic12(1), P(2,0), "\$x\$-\$y\$",r); // the cubic bold(Red(1.6)); base(Red(0.6), "2pt"); plot(cubic, -1, 1, 60); } int main() { picture(P(-1,0), P(1.25,1), "4.5 x 2in"); begin(); screen scr_left(P(-MAX,-MAX), P(MAX,MAX)); activate(scr_left); border(Black(), "1pt"); camera.at(sph(10, 0.8, 0.5)); camera.look_at(P(0,0,-0.25)); draw_frame(); base(Neutral()); screen scr_right(P(-MAX,-MAX), P(MAX,MAX)); activate(scr_right); border(Black(), "1pt"); camera.at(sph(10, 0.9, 0.5)); camera.look_at(P(0,0,-0.25)); draw_frame(); inset(scr_left, P(0.25,0), P(1.25,1)); inset(scr_right, P(-1,0), P(0,1)); end(); }