aboutsummaryrefslogtreecommitdiff
path: root/extensions
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2015-10-12 22:55:41 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2015-10-12 22:55:41 +0800
commit9b5621bda033c2e6b7c622c7494c56a172543554 (patch)
treef5fd661441867ca8a100d5c8aedcce430864d9d4 /extensions
parent627d814f487ac38d4f9b9b71da9bef46f33b3dad (diff)
downloadbullet-lab-remix-9b5621bda033c2e6b7c622c7494c56a172543554.tar.xz
Initial implementation of smPath.
Minor changes on the (s)coll effect.
Diffstat (limited to 'extensions')
-rw-r--r--extensions/smpath.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/extensions/smpath.cpp b/extensions/smpath.cpp
new file mode 100644
index 0000000..d86e18b
--- /dev/null
+++ b/extensions/smpath.cpp
@@ -0,0 +1,13 @@
+#include <cmath>
+#include "smpath.hpp"
+smPathSegment::smPathSegment(smvec2d _a,smvec2d _b){a=_a,b=_b;}
+smvec2d smPathSegment::getPointOnPath(double percentage)
+{return a+percentage*(b-a);}
+double smPathSegment::getPathLength()
+{return (a-b).l();}
+smPathCircular::smPathCircular(smvec2d _ctr,double _a,double _b,double _r)
+{ctr=_ctr,a=_a,b=_b,r=_r;}
+smvec2d smPathCircular::getPointOnPath(double percentage)
+{return smvec2d(ctr.x+r*cos(a+percentage*(b-a)),ctr.y+r*sin(a+percentage*(b-a)));}
+double smPathCircular::getPathLength()
+{return fabs(a-b)*r;}