chiark / gitweb /
merge into history old stuff found on chiark
[moebius.git] / transforms.hh
1 /*
2  * Transformations
3  */
4
5 #ifndef TRANSFORMS_HH
6 #define TRANSFORMS_HH
7
8 #include "library.hh"
9
10 class RotationTransform: public Transform {
11 protected:
12   double s,c;
13 public:
14   RotationTransform(double theta);
15 };
16
17 class XZRotationTransform : public RotationTransform {
18   /*
19    *          Y |
20    *            |    <\ (positive theta)
21    *            |     /
22    *            /-------- X
23    *           /
24    *        Z / \--->
25    */
26 public:
27   XZRotationTransform(double theta) : RotationTransform(theta) { }
28   Point operator()(Point);
29 };
30
31 class YZRotationTransform : public RotationTransform {
32   /*
33    *          Y | _
34    *            |/ \ (positive theta)
35    *          ^ |  V
36    *          | /-------- X
37    *          \/
38    *        Z /
39    */
40 public:
41   YZRotationTransform(double theta) : RotationTransform(theta) { }
42   Point operator()(Point);
43 };
44
45 class TearOpenTransform : public Transform {
46   double factor;
47   double apexy;
48 public:
49   TearOpenTransform(double amt, double apy=1.3);
50   Point operator()(Point in);
51 };
52
53 class BulgeTransform : public Transform {
54   double amount;
55   double variance;
56   double apexy;
57 public:
58   BulgeTransform(double amt, double stddev, double apy=1.1);
59   Point operator()(Point in);
60 };
61
62 class TwistTransform : public Transform {
63   double factor;
64   double apexy;
65 public:
66   TwistTransform(double amt, double apy=1.2) { factor=amt; apexy=apy; }
67   Point operator()(Point in);
68 };
69
70 class ShearTransform : public Transform {
71   Point epicentre;
72   Point magnitude;
73   Point deviation;
74 public:
75   ShearTransform(Point ec, Point mag, Point dev) {
76     epicentre=ec; magnitude=mag; deviation=dev;
77   }
78   Point operator()(Point in);
79 };
80
81 class ScaleTransform : public Transform {
82   double scale;
83 public:
84   ScaleTransform(double s) { scale= s; }
85   Point operator()(Point in);
86 };
87
88 class MagicTransform : public Transform {
89   double xkonstant, xfactor, yoffset, yfactor, zfactor;
90 public:
91   MagicTransform(double xk, double xf, double zf,
92                  double yfudge=0.25, double yo=0.5, double yf=-0.5) {
93     xkonstant=xk; xfactor=xf; yoffset=yo+yfudge; yfactor=yf; zfactor=zf;
94   }
95   Point operator()(Point in);
96 };
97
98 #endif