ePiX2, fichiers SVG

svgtest2.cc [ source ]
#include "epix2.h"
using namespace ePiX2;
 
const double MAX(2.5);
 
int main() {
 
  World world;
  Camera camera;
  Picture picture(Pair(-MAX,-MAX), Pair(MAX,MAX), "400x400pt");
 
  picture.backing(Black());
 
  Pen red(Red(), "1.5pt");
  Pen green(Green(0.6), "1pt");
  Pen yellow(Yellow(), PLAIN_WIDTH);
 
  // Ink clear(Neutral(), 0, true);
 
#ifdef ORTHANTS
  Sphere S1(Origin, 2, 48, 32);
  // S1.rotate(-M_PI_4,E_1()).limn(yellow);
  S1.limn(yellow);
  S1.chop(Knife(E_1(), red))
    .chop(Knife(E_2(), red))
    .chop(Knife(E_3(), red));
 
  Sphere S2(Origin, 2, 48, 32);
  // S2.rotate(-M_PI_4,E_1()).limn(yellow);
  S2.limn(yellow);
  S2.chop(Knife( E_1(), red))
    .chop(Knife(-E_2(), red))
    .chop(Knife(-E_3(), red));
 
  Sphere S3(Origin, 2, 48, 32);
  // S3.rotate(-M_PI_4,E_1()).limn(yellow);
  S3.limn(yellow);
  S3.chop(Knife(-E_1(), red))
    .chop(Knife( E_2(), red))
    .chop(Knife(-E_3(), red));
 
  Sphere S4(Origin, 2, 48, 32);
  S4.limn(yellow);
  // S4.rotate(-M_PI_4,E_1()).limn(yellow);
  S4.chop(Knife(-E_1(), red))
    .chop(Knife(-E_2(), red))
    .chop(Knife( E_3(), red));
 
  world << S1 << S2 << S3 << S4;
#endif
 
#ifdef SKEL
  unsigned int N1(12), N2(8);
  Compound S5;
  for (int i=0; i<N1; ++i) // longitudes
    {
      Vector perp(Origin, Cos(i*M_PI/N1), Sin(i*M_PI/N1), 0);
      S5 << Circle(Origin, 2, perp);
    }
 
  for (int j=1; j<N2; ++j)
    {
      Point ctr(0,0,2*Cos(j*M_PI/N2));
      S5 << Circle(ctr, 2*Sin(j*M_PI/N2), E_3(ctr));
    }
 
  // S5.rotate(-M_PI_4,E_1()).stroke(yellow);
  world << S5.stroke(yellow);
#endif
 
#ifdef TEXT
  text_style().text(Red()).back(White()).align(tr);
  world << Label(Point(0,0,2), "$N$", MK_BOX);
#endif
 
  camera.at(Point(8,10,12)).roll(M_PI/6);
 
  Ink gold(RGB(1,0.9,0.6), 0.5, true);
 
  world.paint(gold);
  world.light(Point(1,-20,60), Green())
    .light(Point(40,-20,-20), Blue())
    .light(Point(-40,-20,-20), Red())
    .light(Point(1,-20,-20));
 
  world.photo(picture, camera);
  picture.print_to("svgtest4.svg", SVG());
}