summaryrefslogtreecommitdiff
path: root/graphics/epix/samples/spherical.xp
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /graphics/epix/samples/spherical.xp
Initial commit
Diffstat (limited to 'graphics/epix/samples/spherical.xp')
-rw-r--r--graphics/epix/samples/spherical.xp76
1 files changed, 76 insertions, 0 deletions
diff --git a/graphics/epix/samples/spherical.xp b/graphics/epix/samples/spherical.xp
new file mode 100644
index 0000000000..c40b897e8f
--- /dev/null
+++ b/graphics/epix/samples/spherical.xp
@@ -0,0 +1,76 @@
+/* -*-ePiX-*- */
+#include "epix.h"
+using namespace ePiX;
+
+const double MAX(3);
+
+int main()
+{
+ picture(P(-MAX,-MAX),P(MAX,MAX), "6x6in");
+
+ begin();
+ camera.at(30,5,20);
+
+#ifdef GRAY
+ camera.filter(Gray_Neutral());
+#endif
+ revolutions();
+
+ domain R(P(0,0,-0.25), P(3,1,0.25), mesh(12, 48, 24), mesh(12, 96, 120));
+
+ std::list<domain> cuts;
+
+ double Phi(7.0/48), Theta(7.0/48);
+
+ cuts.push_back(R.slice1(2));
+ cuts.push_back(R.slice2(0));
+ cuts.push_back(R.slice2(Theta));
+ cuts.push_back(R.slice3(0));
+ cuts.push_back(R.slice3(Phi));
+
+ plain(Black(0.5));
+ fill(Red(1.9));
+ scenery coords(sph, R.slice1(2)); // rho = 2
+
+ fill(Yellow(0.35));
+ coords.add(sph, R.slice2(0)).add(sph, R.slice2(Theta)); // theta = 0, Theta
+
+ fill(Blue(1.9));
+ coords.add(sph, R.slice3(0)).add(sph, R.slice3(Phi)); // phi = 0, Phi
+
+ coords.draw();
+ // surface(sph, cuts);
+ fill(false);
+
+ pen(Black());
+ base(White(), "1.2pt");
+ arrow_fill(1);
+ arrow(P(3,0,0), P(3.5,0,0));
+ label(P(3.5,0,0), P(-2,-2), "$x$", bl);
+
+ arrow(P(0,3,0), P(0,3.5,0));
+ label(P(0,3.5,0), P(2,-2), "$y$", br);
+
+ arrow(P(0,0,3), P(0,0,3.5));
+ label(P(0,0,3.5), P(0,4), "$z$", t);
+
+ bold();
+ arc_arrow(P(0,0,0), 2, 0.5*Theta, Theta);
+ arc_arrow(P(0,0,0), 2, 0.5*Theta, 0);
+
+ aarrow(P(0,0,0), sph(2, Theta, Phi));
+
+ label(sph(2, 0.5*Theta, 0), P(2,2), "$\\theta$", t);
+ label(sph(2, Theta, 0.5*Phi), P(-2,0), "$\\phi$", l);
+ label(sph(1, Theta, Phi), P(2,-2), "$\\rho$", br);
+
+ base(Neutral(), 0);
+ dashed();
+ plain();
+ line(P(0,0,0), P(2,0,0));
+ line(P(0,0,0), sph(2, Theta, 0));
+ line(P(0,0,0), sph(2, Theta, Phi));
+
+ pst_format();
+ end();
+}