/* -*-ePiX-*- */ /* torus.xp -- April 02, 2003 */ #include "epix.h" using namespace ePiX; P F(double t1, double t2) { return P(Cos(t1)*(2+Sin(t2)), Sin(t1)*(2+Sin(t2)), Cos(t2)); } const int N = 12; // to control fineness of mesh domain R(P(0,0), P(1,1), mesh(4*N, 2*N), mesh(6*N, 6*N)); domain R1(P(0,0), P(1,1), mesh(1,1), mesh(60,60)); int main() { unitlength("1pt"); bounding_box(P(-3,-2), P(3,2)); picture(300,200); begin(); viewpoint(1.7,-1, 0.75); camera.range(6); revolutions(); // bulk of torus rgb(0.2, 0.5, 0.7); plot(F, R.resize1(0,0.875)); // purple patch bold(); rgb(0.5, 0.3, 0.9); plot(F, R.resize1(0, 0.125).resize2(-0.375, 0)); // latitude and longitude red(); dashed(); plot(F, R1); end(); }