From 2c7657c48db74de5a512c55165df80b877b38d33 Mon Sep 17 00:00:00 2001 From: "B. Bogart" Date: Mon, 16 Sep 2002 16:36:20 +0000 Subject: Added arguments to "reset" method, allows reseting to particular initial conditions. svn path=/trunk/externals/bbogart/chaos/; revision=128 --- henon.c | 8 +++++--- henon.pd | 16 ++++++++-------- ikeda.c | 8 +++++--- ikeda.pd | 16 ++++++++-------- lorenz.c | 11 +++++++---- lorenz.pd | 12 ++++++------ rossler.c | 11 +++++++---- rossler.pd | 14 +++++++------- 8 files changed, 53 insertions(+), 43 deletions(-) diff --git a/henon.c b/henon.c index 54cf4e2..a67addd 100644 --- a/henon.c +++ b/henon.c @@ -53,10 +53,10 @@ static void calculate(henon_struct *x) outlet_float(x->y_outlet, (t_float)ly1); } -static void reset(henon_struct *x) +static void reset(henon_struct *x, t_floatarg lx0, t_floatarg ly0) { - x->lx0 = 1; - x->ly0 = 1; + x->lx0 = lx0; + x->ly0 = ly0; } static void param(henon_struct *x, t_floatarg a, t_floatarg b) @@ -96,6 +96,8 @@ void henon_setup(void) class_addmethod(henon_class, (t_method)reset, gensym("reset"), + A_DEFFLOAT, + A_DEFFLOAT, 0); class_addmethod(henon_class, diff --git a/henon.pd b/henon.pd index dc90e54..99c9db8 100644 --- a/henon.pd +++ b/henon.pd @@ -1,9 +1,8 @@ -#N canvas 48 298 368 335 10; +#N canvas 450 295 368 335 10; #X obj 29 114 metro 50; -#X obj 29 90 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 0 1 +#X obj 29 90 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 1 1 ; #X floatatom 80 89 5 0 0; -#X msg 114 143 reset; #X floatatom 74 285 5 0 0; #X text 5 66 Calculate; #X text 113 161 Reset To Initial Conditions; @@ -15,10 +14,11 @@ #X obj 29 177 henon; #X text 5 6 Henon's Attractor; #X text 3 37 (This attractor is not continuous); -#X connect 0 0 12 0; +#X msg 114 143 reset 1 1; +#X connect 0 0 11 0; #X connect 1 0 0 0; #X connect 2 0 0 1; -#X connect 3 0 12 0; -#X connect 11 0 12 0; -#X connect 12 0 8 0; -#X connect 12 1 4 0; +#X connect 10 0 11 0; +#X connect 11 0 7 0; +#X connect 11 1 3 0; +#X connect 14 0 11 0; diff --git a/ikeda.c b/ikeda.c index 4734147..0c2fa21 100644 --- a/ikeda.c +++ b/ikeda.c @@ -61,10 +61,10 @@ static void calculate(ikeda_struct *x) outlet_float(x->y_outlet, (t_float)ly1); } -static void reset(ikeda_struct *x) +static void reset(ikeda_struct *x, t_floatarg lx0, t_floatarg ly0) { - x->lx0 = 0.1; - x->ly0 = 0.1; + x->lx0 = lx0; + x->ly0 = ly0; } static void param(ikeda_struct *x, t_floatarg a, t_floatarg b, t_floatarg c, t_floatarg rho) @@ -108,6 +108,8 @@ void ikeda_setup(void) class_addmethod(ikeda_class, (t_method)reset, gensym("reset"), + A_DEFFLOAT, + A_DEFFLOAT, 0); class_addmethod(ikeda_class, diff --git a/ikeda.pd b/ikeda.pd index d4e3c91..e94bfca 100644 --- a/ikeda.pd +++ b/ikeda.pd @@ -1,9 +1,8 @@ #N canvas 48 298 368 335 10; #X obj 29 114 metro 50; -#X obj 29 90 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 0 1 +#X obj 29 90 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 1 1 ; #X floatatom 80 89 5 0 0; -#X msg 114 143 reset; #X floatatom 74 285 5 0 0; #X text 5 66 Calculate; #X text 113 161 Reset To Initial Conditions; @@ -16,11 +15,12 @@ #X msg 116 215 param 0.4 0.9 6 1; #X msg 116 193 param 0.4 0.8 20 1; #X text 5 6 Ikeda Attractor; -#X connect 0 0 12 0; +#X msg 114 143 reset 0.1 0.1; +#X connect 0 0 11 0; #X connect 1 0 0 0; #X connect 2 0 0 1; -#X connect 3 0 12 0; -#X connect 12 0 8 0; -#X connect 12 1 4 0; -#X connect 13 0 12 0; -#X connect 14 0 12 0; +#X connect 11 0 7 0; +#X connect 11 1 3 0; +#X connect 12 0 11 0; +#X connect 13 0 11 0; +#X connect 15 0 11 0; diff --git a/lorenz.c b/lorenz.c index ecc206b..95994c9 100644 --- a/lorenz.c +++ b/lorenz.c @@ -60,11 +60,11 @@ static void calculate(lorenz_struct *x) outlet_float(x->z_outlet, (t_float)lz1); } -static void reset(lorenz_struct *x) +static void reset(lorenz_struct *x, t_floatarg lx0, t_floatarg ly0, t_floatarg lz0) { - x->lx0 = 0.1; - x->ly0 = 0; - x->lz0 = 0; + x->lx0 = lx0; + x->ly0 = ly0; + x->lz0 = lz0; } static void param(lorenz_struct *x, t_floatarg h, t_floatarg a, t_floatarg b, t_floatarg c) @@ -111,6 +111,9 @@ void lorenz_setup(void) class_addmethod(lorenz_class, (t_method)reset, gensym("reset"), + A_DEFFLOAT, + A_DEFFLOAT, + A_DEFFLOAT, 0); class_addmethod(lorenz_class, diff --git a/lorenz.pd b/lorenz.pd index fcbc560..55170fc 100644 --- a/lorenz.pd +++ b/lorenz.pd @@ -4,7 +4,6 @@ ; #X floatatom 80 89 5 0 0; #X obj 29 177 lorenz; -#X msg 114 143 reset; #X floatatom 74 285 5 0 0; #X msg 115 194 param 0.02 10 28 2.667; #X text 5 6 Lorenz's Attractor; @@ -15,11 +14,12 @@ #X floatatom 120 285 5 0 0; #X text 58 258 Output; #X text 4 21 Chaos PD Externals - Copyright Ben Bogart 2002; +#X msg 114 143 reset 0.1 0 0; #X connect 0 0 3 0; #X connect 1 0 0 0; #X connect 2 0 0 1; -#X connect 3 0 11 0; -#X connect 3 1 5 0; -#X connect 3 2 12 0; -#X connect 4 0 3 0; -#X connect 6 0 3 0; +#X connect 3 0 10 0; +#X connect 3 1 4 0; +#X connect 3 2 11 0; +#X connect 5 0 3 0; +#X connect 14 0 3 0; diff --git a/rossler.c b/rossler.c index 07f8285..867a9e0 100644 --- a/rossler.c +++ b/rossler.c @@ -60,11 +60,11 @@ static void calculate(rossler_struct *x) outlet_float(x->z_outlet, (t_float)lz1); } -static void reset(rossler_struct *x) +static void reset(rossler_struct *x, t_floatarg lx0, t_floatarg ly0, t_floatarg lz0) { - x->lx0 = 0.1; - x->ly0 = 0; - x->lz0 = 0; + x->lx0 = lx0; + x->ly0 = ly0; + x->lz0 = lz0; } static void param(rossler_struct *x, t_floatarg h, t_floatarg a, t_floatarg b, t_floatarg c) @@ -109,6 +109,9 @@ void rossler_setup(void) class_addmethod(rossler_class, (t_method)reset, gensym("reset"), + A_DEFFLOAT, + A_DEFFLOAT, + A_DEFFLOAT, 0); class_addmethod(rossler_class, diff --git a/rossler.pd b/rossler.pd index fc76b24..1b07ebe 100644 --- a/rossler.pd +++ b/rossler.pd @@ -3,7 +3,6 @@ #X obj 29 90 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 0 1 ; #X floatatom 80 89 5 0 0; -#X msg 114 143 reset; #X floatatom 74 285 5 0 0; #X text 5 66 Calculate; #X text 113 161 Reset To Initial Conditions; @@ -15,11 +14,12 @@ #X obj 29 177 rossler; #X msg 115 193 param 0.01 0.39 0.4 5.8; #X text 5 6 Rossler's Attractor; -#X connect 0 0 12 0; +#X msg 114 143 reset 0.1 0 0; +#X connect 0 0 11 0; #X connect 1 0 0 0; #X connect 2 0 0 1; -#X connect 3 0 12 0; -#X connect 12 0 8 0; -#X connect 12 1 4 0; -#X connect 12 2 9 0; -#X connect 13 0 12 0; +#X connect 11 0 7 0; +#X connect 11 1 3 0; +#X connect 11 2 8 0; +#X connect 12 0 11 0; +#X connect 14 0 11 0; -- cgit v1.2.1