summaryrefslogtreecommitdiff
path: root/gui/libs/ofxAChaosLib/src/AChaosHenonPhase.h
blob: 02dec0fb39257d60524a32879aec9dcf7c2c7e02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
	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 AChaosHenonPhase : public AChaosBase {
public:

	REAL a, b, nx, ny, dt, t;
	
	AChaosHenonPhase(){}
	~AChaosHenonPhase(){}	

	vector<string> param_labels={"a","b","","","dt","t"};
	virtual vector<string> &get_param_labels(){return this->param_labels;};

	virtual void setup(REAL * params = NULL){
	
		AChaosBase::init(params, 5, 2);	
		if(params==NULL){	
			//init	
			a = 1.4f;
			b = 0.3f;
			nx = 1.0f;
			ny = 1.0f;
			dt = 0.01f;
			t=0.0f;
			REAL p[5] = {nx,ny, a,b,dt};
			set(p);
		}  else { set(params); }
	
	}



	void reset(){
		nx = iv[0];
		ny = iv[1];
		a = iv[2];
		b = iv[3];
		dt = iv[4];
	}
	
 	void calc(){ 		
		// Henon Phase Diagrams
 		REAL cosa=COS(a),sina=SIN(a);

		nx = nx*cosa-(ny-nx*nx)*sina;
		ny = nx*sina-(ny-nx*nx)*cosa;

		ov[0] = nx;
		ov[1] = ny;
 	}
};