aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2015-11-01 23:33:50 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2015-11-01 23:33:50 +0800
commit6655926e01396139f4b81323d8adcc734bc4284e (patch)
treec12d5eee4e30025b3ac7b4600c96b68e8be5dbf4 /include
parentbdcabc1e059ba9415e8d1f8cb436c77545680670 (diff)
downloadSMELT-6655926e01396139f4b81323d8adcc734bc4284e.tar.xz
Add smPath source files.
Sync with the latest BLR3.
Diffstat (limited to 'include')
-rw-r--r--include/smpath.hpp56
1 files changed, 56 insertions, 0 deletions
diff --git a/include/smpath.hpp b/include/smpath.hpp
new file mode 100644
index 0000000..98eec6f
--- /dev/null
+++ b/include/smpath.hpp
@@ -0,0 +1,56 @@
+// -*- C++ -*-
+/*
+ * Simple MultimEdia LiTerator(SMELT)
+ * by Chris Xiong 2015
+ * Path/Curve header & implementation
+ *
+ * WARNING: This library is in development and interfaces would be very
+ * unstable.
+ *
+ */
+#ifndef SMPATH_H
+#define SMPATH_H
+#include "smmath.hpp"
+class smPathBase
+{
+public:
+ virtual smvec2d getPointOnPath(double rt){return smvec2d(0,0);}
+ virtual double getPathLength()//default lowres length calculator
+ {
+ double ret=0;
+ for(int i=0;i<63;++i)
+ ret+=(getPointOnPath(i/64.)-getPointOnPath((i+1)/64.)).l();
+ return ret;
+ }
+ virtual ~smPathBase(){}
+};
+class smPathSegment:public smPathBase
+{
+private:
+ smvec2d a,b;
+public:
+ smPathSegment(smvec2d _a,smvec2d _b);
+ smvec2d getPointOnPath(double rt)override;
+ double getPathLength()override;
+};
+class smPathCircular:public smPathBase
+{
+private:
+ smvec2d ctr;
+ double a,b,r;
+public:
+ smPathCircular(smvec2d _ctr,double _a,double _b,double _r);
+ smvec2d getPointOnPath(double rt)override;
+ double getPathLength()override;
+};
+class smPathCollection
+{
+private:
+ smPathBase* paths[16];
+ int cpaths;
+public:
+ int pushPath(smPathBase *p);
+ smPathBase* getPath(int pid);
+ smvec2d getPointOnCollection(double rt);
+};
+#endif