summaryrefslogtreecommitdiff
path: root/gui/libs/ofxAChaosLib/src/AChaosDuffing.h
diff options
context:
space:
mode:
authorTim Redfern <tim@getdrop.com>2018-07-08 12:22:06 +0100
committerTim Redfern <tim@getdrop.com>2018-07-08 12:22:06 +0100
commitfb68eed64f548d090eb550047fd0d898e4e033fc (patch)
tree890fa917ca6bd88505b45e5c261d05e0c5c9b6ec /gui/libs/ofxAChaosLib/src/AChaosDuffing.h
parentc10665e02e49da2d8f7e1a1eada151f17f507a21 (diff)
add altered AChaoslib
Diffstat (limited to 'gui/libs/ofxAChaosLib/src/AChaosDuffing.h')
-rw-r--r--gui/libs/ofxAChaosLib/src/AChaosDuffing.h57
1 files changed, 57 insertions, 0 deletions
diff --git a/gui/libs/ofxAChaosLib/src/AChaosDuffing.h b/gui/libs/ofxAChaosLib/src/AChaosDuffing.h
new file mode 100644
index 0000000..338c324
--- /dev/null
+++ b/gui/libs/ofxAChaosLib/src/AChaosDuffing.h
@@ -0,0 +1,57 @@
+/*
+ 32/64 bits A-Chaos Lib in openFrameworks
+ (c) s373.net/x 2004, 2012, 2015
+ http://s373.net/code/A-Chaos-Lib/A-Chaos.html
+ programmed by Andre Sier, revised 2015
+ License: MIT
+*/
+#pragma once
+#include "AChaosBase.h"
+
+class AChaosDuffing : public AChaosBase {
+public:
+
+ REAL a, b, w, t, dt, nx, ny;
+
+ AChaosDuffing(){}
+ ~AChaosDuffing(){}
+
+ vector<string> param_labels={"a","b","w","t","dt","",""};
+
+ virtual void setup(REAL * params = NULL){
+
+ AChaosBase::init(params, 7, 2);
+ if(params==NULL){
+ //init
+ a = 0.25f;
+ b = 0.3f;
+ w = 1.0f;
+ nx = 0.0f;
+ ny = 0.0f;
+ dt = 0.01f;
+ t = 0.0f;
+ REAL p[7] = {a,b,w,nx,ny,dt,t};
+ set(p);
+ } else { set(params); }
+
+ }
+
+ void reset(){
+ a = iv[0];
+ b = iv[1];
+ w = iv[2];
+ nx = iv[3];
+ ny = iv[4];
+ dt = iv[5];
+ t = iv[6];
+ }
+
+ void calc(){
+ t += dt;
+ nx = ny;
+ ny = nx-(nx*nx*nx)-(a*ny)+(b*COS(w*t));
+
+ ov[0] = nx;
+ ov[1] = ny;
+ }
+}; \ No newline at end of file