aboutsummaryrefslogtreecommitdiff
path: root/curve.h
diff options
context:
space:
mode:
authorFranklin Wei <me@fwei.tk>2019-02-02 23:02:12 -0500
committerFranklin Wei <me@fwei.tk>2019-02-02 23:02:12 -0500
commit79a83c2cbee5adca798b8976b2a39ecd6ffd39af (patch)
tree379523f81d3e7dc02c62ca1505376b8d0bc6b30e /curve.h
downloadfieldviz-79a83c2cbee5adca798b8976b2a39ecd6ffd39af.zip
fieldviz-79a83c2cbee5adca798b8976b2a39ecd6ffd39af.tar.gz
fieldviz-79a83c2cbee5adca798b8976b2a39ecd6ffd39af.tar.bz2
fieldviz-79a83c2cbee5adca798b8976b2a39ecd6ffd39af.tar.xz
initial commit
basic B field integrator
Diffstat (limited to 'curve.h')
-rw-r--r--curve.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/curve.h b/curve.h
new file mode 100644
index 0000000..c896a23
--- /dev/null
+++ b/curve.h
@@ -0,0 +1,28 @@
+#include <cmath>
+#include "vec3.h"
+using namespace std;
+
+class Curve {
+public:
+ virtual vec3 integrate(vec3 (*integrand)(vec3 s, vec3 ds), double delta) = 0;
+};
+
+class LineSegment : Curve {
+private:
+ vec3 a, b;
+public:
+ LineSegment(vec3 a_, vec3 b_) : a(a_), b(b_) {};
+
+ vec3 integrate(vec3 (*integrand)(vec3 s, vec3 ds), double delta);
+};
+
+class Arc : Curve {
+private:
+ vec3 center;
+ double radius;
+ double angle[2]; /* start and end angles */
+public:
+ LineSegment(vec3 a_, vec3 b_) : a(a_), b(b_) {};
+
+ vec3 integrate(vec3 (*integrand)(vec3 s, vec3 ds), double delta);
+};