summaryrefslogtreecommitdiff
path: root/gui/libs/ofxAChaosLib/src/AChaosHenon.h
blob: 929a354bb07eb00cf18a38418291b27c710aef8c (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
/*
	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 AChaosHenon : public AChaosBase {
public:

	REAL a, b, nx, ny;

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

	virtual void setup(REAL * params = NULL){
		AChaosBase::init(params, 4,2);
		if(params==NULL){
			//init	
			a = 1.4f;
			b = 0.3f;
			nx = 1.0f;
			ny = 1.0f;

			REAL p[4] = {a,b,nx,ny};
			set(p);
		} else {
			set(params);
		}
	}

	void reset(){
		a = iv[0];
		b = iv[1];
		nx = iv[2];
		ny = iv[3];
	}
	
 	void calc(){ 		
		// henon 		
		nx = (ny + 1) - (a * (nx*nx));
		ny = b * nx;

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