From 5233c01a26329306c9f1d08c1a39733aee2cc518 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Tue, 21 Dec 2004 09:22:10 +0000 Subject: This commit was generated by cvs2svn to compensate for changes in r2423, which included commits to RCS files with non-trunk default branches. svn path=/trunk/externals/tb/; revision=2424 --- chaos/src/ikeda_laser_map.hpp | 153 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 153 insertions(+) create mode 100644 chaos/src/ikeda_laser_map.hpp (limited to 'chaos/src/ikeda_laser_map.hpp') diff --git a/chaos/src/ikeda_laser_map.hpp b/chaos/src/ikeda_laser_map.hpp new file mode 100644 index 0000000..39d75c4 --- /dev/null +++ b/chaos/src/ikeda_laser_map.hpp @@ -0,0 +1,153 @@ +// +// +// chaos~ +// Copyright (C) 2004 Tim Blechmann +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; see the file COPYING. If not, write to +// the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + +#include "map_base.hpp" +#include + +// ikeda laser map: z[n+1] = roh + c2 * z[n] * +// exp (j * (c1 - c3 / (1 + abs(z) * abs(z)))) +// z is complex +// +// equal: x[n+1] = roh + c2 * (x[n] * cos(tau) - y[n] * sin (tau)) +// y[n+1] = c2 * (x[n] * sin(tau) + y[n] * cos(tau)) +// tau = c1 - (c2 / (1 + x*x + y*y)) +// +// taken from Willi-Hans Steeb: Chaos and Fractals + +class ikeda: + protected map_base +{ +public: + ikeda() + : m_c1(0.4), m_c2(0.9), m_c3(9), m_roh(0.85) + { + m_num_eq = 2; + m_data = new data_t[2]; + set_x(0.5); + set_y(0.5); + } + + ~ikeda() + { + delete m_data; + } + + virtual void m_step() + { + data_t x = m_data[0]; + data_t y = m_data[1]; + + data_t tau = m_c1 - m_c3 / (1 + x*x + y*y); + data_t cos_tau = cos(tau); + data_t sin_tau = sin(tau); + + m_data[0] = m_roh + m_c2 * (x * cos_tau - y * sin_tau); + m_data[1] = m_c2 * (x * sin_tau + y * cos_tau); + } + + + void set_x(t_float f) + { + m_data[0] = (data_t) f; + } + + t_float get_x() + { + return (t_float)m_data[0]; + } + + void set_y(t_float f) + { + m_data[1] = (data_t) f; + } + + t_float get_y() + { + return (t_float)m_data[1]; + } + + + void set_c1(t_float f) + { + m_c1 = (data_t) f; + } + + t_float get_c1() + { + return (t_float)m_c1; + } + + + void set_c2(t_float f) + { + m_c2[1] = (data_t) f; + } + + t_float get_c2() + { + return (t_float)m_c2; + } + + + void set_c3(t_float f) + { + m_c3 = (data_t) f; + } + + t_float get_c3() + { + return (t_float)m_c3; + } + + + void set_roh(t_float f) + { + m_roh = (data_t) f; + } + + t_float get_roh() + { + return (t_float)m_roh; + } + + +private: + data_t m_c1, m_c2, m_c3, m_roh; +}; + + +#define IKEDA_CALLBACKS \ +MAP_CALLBACKS; \ +FLEXT_CALLVAR_F(m_system->get_c1, m_system->set_c1); \ +FLEXT_CALLVAR_F(m_system->get_c2, m_system->set_c2); \ +FLEXT_CALLVAR_F(m_system->get_c3, m_system->set_c3); \ +FLEXT_CALLVAR_F(m_system->get_roh, m_system->set_roh); \ +FLEXT_CALLVAR_F(m_system->get_x, m_system->set_x); \ +FLEXT_CALLVAR_F(m_system->get_y, m_system->set_y); \ + + +#define IKEDA_ATTRIBUTES \ +MAP_ATTRIBUTES; \ +FLEXT_ADDATTR_VAR("c1",m_system->get_c1, m_system->set_c1); \ +FLEXT_ADDATTR_VAR("c2",m_system->get_c2, m_system->set_c2); \ +FLEXT_ADDATTR_VAR("c3",m_system->get_c3, m_system->set_c3); \ +FLEXT_ADDATTR_VAR("roh",m_system->get_roh, m_system->set_roh); \ +FLEXT_ADDATTR_VAR("x",m_system->get_x, m_system->set_x); \ +FLEXT_ADDATTR_VAR("y",m_system->get_y, m_system->set_y); -- cgit v1.2.1 From 404bfef9e23dfc3166cb2005367e7e8a41863914 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Thu, 23 Dec 2004 10:07:17 +0000 Subject: base class macros svn path=/trunk/externals/tb/; revision=2426 --- chaos/src/ikeda_laser_map.hpp | 126 ++++++++++++------------------------------ 1 file changed, 35 insertions(+), 91 deletions(-) (limited to 'chaos/src/ikeda_laser_map.hpp') diff --git a/chaos/src/ikeda_laser_map.hpp b/chaos/src/ikeda_laser_map.hpp index 39d75c4..ccc14cc 100644 --- a/chaos/src/ikeda_laser_map.hpp +++ b/chaos/src/ikeda_laser_map.hpp @@ -36,12 +36,15 @@ class ikeda: { public: ikeda() - : m_c1(0.4), m_c2(0.9), m_c3(9), m_roh(0.85) { m_num_eq = 2; m_data = new data_t[2]; - set_x(0.5); - set_y(0.5); + CHAOS_SYS_INIT(c1,0.4); + CHAOS_SYS_INIT(c2,0.9); + CHAOS_SYS_INIT(c3,9); + CHAOS_SYS_INIT(roh,0.85); + CHAOS_SYS_INIT(x,0.5); + CHAOS_SYS_INIT(y,0.5); } ~ikeda() @@ -54,100 +57,41 @@ public: data_t x = m_data[0]; data_t y = m_data[1]; - data_t tau = m_c1 - m_c3 / (1 + x*x + y*y); + data_t tau = CHAOS_PARAMETER(c1) - + CHAOS_PARAMETER(c3) / (1 + x*x + y*y); data_t cos_tau = cos(tau); data_t sin_tau = sin(tau); - m_data[0] = m_roh + m_c2 * (x * cos_tau - y * sin_tau); - m_data[1] = m_c2 * (x * sin_tau + y * cos_tau); + m_data[0] = CHAOS_PARAMETER(roh) + CHAOS_PARAMETER(c2) + * (x * cos_tau - y * sin_tau); + m_data[1] = CHAOS_PARAMETER(c2) * (x * sin_tau + y * cos_tau); } - - void set_x(t_float f) - { - m_data[0] = (data_t) f; - } - - t_float get_x() - { - return (t_float)m_data[0]; - } - - void set_y(t_float f) - { - m_data[1] = (data_t) f; - } - - t_float get_y() - { - return (t_float)m_data[1]; - } - - - void set_c1(t_float f) - { - m_c1 = (data_t) f; - } - - t_float get_c1() - { - return (t_float)m_c1; - } - - - void set_c2(t_float f) - { - m_c2[1] = (data_t) f; - } - - t_float get_c2() - { - return (t_float)m_c2; - } - - - void set_c3(t_float f) - { - m_c3 = (data_t) f; - } - - t_float get_c3() - { - return (t_float)m_c3; - } - - - void set_roh(t_float f) - { - m_roh = (data_t) f; - } - - t_float get_roh() - { - return (t_float)m_roh; - } - + CHAOS_SYSVAR_FUNCS(x, 0); + CHAOS_SYSVAR_FUNCS(y, 1); -private: - data_t m_c1, m_c2, m_c3, m_roh; -}; + CHAOS_PAR_FUNCS(c1); + CHAOS_PAR_FUNCS(c2); + CHAOS_PAR_FUNCS(c3); + CHAOS_PAR_FUNCS(roh); - -#define IKEDA_CALLBACKS \ -MAP_CALLBACKS; \ -FLEXT_CALLVAR_F(m_system->get_c1, m_system->set_c1); \ -FLEXT_CALLVAR_F(m_system->get_c2, m_system->set_c2); \ -FLEXT_CALLVAR_F(m_system->get_c3, m_system->set_c3); \ -FLEXT_CALLVAR_F(m_system->get_roh, m_system->set_roh); \ -FLEXT_CALLVAR_F(m_system->get_x, m_system->set_x); \ -FLEXT_CALLVAR_F(m_system->get_y, m_system->set_y); \ +}; -#define IKEDA_ATTRIBUTES \ -MAP_ATTRIBUTES; \ -FLEXT_ADDATTR_VAR("c1",m_system->get_c1, m_system->set_c1); \ -FLEXT_ADDATTR_VAR("c2",m_system->get_c2, m_system->set_c2); \ -FLEXT_ADDATTR_VAR("c3",m_system->get_c3, m_system->set_c3); \ -FLEXT_ADDATTR_VAR("roh",m_system->get_roh, m_system->set_roh); \ -FLEXT_ADDATTR_VAR("x",m_system->get_x, m_system->set_x); \ -FLEXT_ADDATTR_VAR("y",m_system->get_y, m_system->set_y); +#define IKEDA_CALLBACKS \ +MAP_CALLBACKS; \ +CHAOS_SYS_CALLBACKS(c1); \ +CHAOS_SYS_CALLBACKS(c2); \ +CHAOS_SYS_CALLBACKS(c3); \ +CHAOS_SYS_CALLBACKS(roh); \ +CHAOS_SYS_CALLBACKS(x); \ +CHAOS_SYS_CALLBACKS(y); + +#define IKEDA_ATTRIBUTES \ +MAP_ATTRIBUTES; \ +CHAOS_SYS_ATTRIBUTE(c1); \ +CHAOS_SYS_ATTRIBUTE(c2); \ +CHAOS_SYS_ATTRIBUTE(c3); \ +CHAOS_SYS_ATTRIBUTE(roh); \ +CHAOS_SYS_ATTRIBUTE(x); \ +CHAOS_SYS_ATTRIBUTE(y); -- cgit v1.2.1 From b2f2fd990f9059db784a7849726c6fc5006c70f9 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Mon, 27 Dec 2004 14:44:11 +0000 Subject: a lot of new objects ... svn path=/trunk/externals/tb/; revision=2431 --- chaos/src/ikeda_laser_map.hpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'chaos/src/ikeda_laser_map.hpp') diff --git a/chaos/src/ikeda_laser_map.hpp b/chaos/src/ikeda_laser_map.hpp index ccc14cc..e267204 100644 --- a/chaos/src/ikeda_laser_map.hpp +++ b/chaos/src/ikeda_laser_map.hpp @@ -31,11 +31,11 @@ // // taken from Willi-Hans Steeb: Chaos and Fractals -class ikeda: - protected map_base +class ikeda_laser_map: + public map_base { public: - ikeda() + ikeda_laser_map() { m_num_eq = 2; m_data = new data_t[2]; @@ -47,7 +47,7 @@ public: CHAOS_SYS_INIT(y,0.5); } - ~ikeda() + ~ikeda_laser_map() { delete m_data; } @@ -70,15 +70,15 @@ public: CHAOS_SYSVAR_FUNCS(x, 0); CHAOS_SYSVAR_FUNCS(y, 1); - CHAOS_PAR_FUNCS(c1); - CHAOS_PAR_FUNCS(c2); - CHAOS_PAR_FUNCS(c3); - CHAOS_PAR_FUNCS(roh); + CHAOS_SYSPAR_FUNCS(c1); + CHAOS_SYSPAR_FUNCS(c2); + CHAOS_SYSPAR_FUNCS(c3); + CHAOS_SYSPAR_FUNCS(roh); }; -#define IKEDA_CALLBACKS \ +#define IKEDA_LASER_MAP_CALLBACKS \ MAP_CALLBACKS; \ CHAOS_SYS_CALLBACKS(c1); \ CHAOS_SYS_CALLBACKS(c2); \ @@ -87,7 +87,7 @@ CHAOS_SYS_CALLBACKS(roh); \ CHAOS_SYS_CALLBACKS(x); \ CHAOS_SYS_CALLBACKS(y); -#define IKEDA_ATTRIBUTES \ +#define IKEDA_LASER_MAP_ATTRIBUTES \ MAP_ATTRIBUTES; \ CHAOS_SYS_ATTRIBUTE(c1); \ CHAOS_SYS_ATTRIBUTE(c2); \ -- cgit v1.2.1 From 2a0d532e5965402f19f74f70dfdcc7efd1055b15 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Sat, 1 Jan 2005 11:06:58 +0000 Subject: speedup using function pointers svn path=/trunk/externals/tb/; revision=2439 --- chaos/src/ikeda_laser_map.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'chaos/src/ikeda_laser_map.hpp') diff --git a/chaos/src/ikeda_laser_map.hpp b/chaos/src/ikeda_laser_map.hpp index e267204..c62bc15 100644 --- a/chaos/src/ikeda_laser_map.hpp +++ b/chaos/src/ikeda_laser_map.hpp @@ -38,7 +38,7 @@ public: ikeda_laser_map() { m_num_eq = 2; - m_data = new data_t[2]; + m_data = new data_t[m_num_eq]; CHAOS_SYS_INIT(c1,0.4); CHAOS_SYS_INIT(c2,0.9); CHAOS_SYS_INIT(c3,9); -- cgit v1.2.1 From 2434290915cda6ed855e4dc2249312153b995817 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Thu, 9 Jun 2005 12:52:17 +0000 Subject: changed initialisation svn path=/trunk/externals/tb/; revision=3145 --- chaos/src/ikeda_laser_map.hpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'chaos/src/ikeda_laser_map.hpp') diff --git a/chaos/src/ikeda_laser_map.hpp b/chaos/src/ikeda_laser_map.hpp index c62bc15..ece0b9f 100644 --- a/chaos/src/ikeda_laser_map.hpp +++ b/chaos/src/ikeda_laser_map.hpp @@ -37,19 +37,22 @@ class ikeda_laser_map: public: ikeda_laser_map() { - m_num_eq = 2; - m_data = new data_t[m_num_eq]; - CHAOS_SYS_INIT(c1,0.4); - CHAOS_SYS_INIT(c2,0.9); - CHAOS_SYS_INIT(c3,9); - CHAOS_SYS_INIT(roh,0.85); - CHAOS_SYS_INIT(x,0.5); - CHAOS_SYS_INIT(y,0.5); + CHAOS_PRECONSTRUCTOR; + + CHAOS_PAR_INIT(c1,0.4); + CHAOS_PAR_INIT(c2,0.9); + CHAOS_PAR_INIT(c3,9); + CHAOS_PAR_INIT(roh,0.85); + + CHAOS_SYS_INIT(x,0.5,0); + CHAOS_SYS_INIT(y,0.5,1); + + CHAOS_POSTCONSTRUCTOR; } ~ikeda_laser_map() { - delete m_data; + } virtual void m_step() -- cgit v1.2.1 From ef53e19b3d9019b1b1f3345390f55ae9229ce390 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Sat, 22 Oct 2005 15:11:45 +0000 Subject: cleanups and new system svn path=/trunk/externals/tb/; revision=3750 --- chaos/src/ikeda_laser_map.hpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'chaos/src/ikeda_laser_map.hpp') diff --git a/chaos/src/ikeda_laser_map.hpp b/chaos/src/ikeda_laser_map.hpp index ece0b9f..3c4d587 100644 --- a/chaos/src/ikeda_laser_map.hpp +++ b/chaos/src/ikeda_laser_map.hpp @@ -35,10 +35,9 @@ class ikeda_laser_map: public map_base { public: - ikeda_laser_map() + ikeda_laser_map(): + map_base(1) { - CHAOS_PRECONSTRUCTOR; - CHAOS_PAR_INIT(c1,0.4); CHAOS_PAR_INIT(c2,0.9); CHAOS_PAR_INIT(c3,9); @@ -46,13 +45,10 @@ public: CHAOS_SYS_INIT(x,0.5,0); CHAOS_SYS_INIT(y,0.5,1); - - CHAOS_POSTCONSTRUCTOR; } ~ikeda_laser_map() { - } virtual void m_step() -- cgit v1.2.1 From 13cba7a7997e318fbba01a36912219355e387d52 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Sun, 21 May 2006 18:34:34 +0000 Subject: rewrote most stuff using templates svn path=/trunk/externals/tb/; revision=5105 --- chaos/src/ikeda_laser_map.hpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'chaos/src/ikeda_laser_map.hpp') diff --git a/chaos/src/ikeda_laser_map.hpp b/chaos/src/ikeda_laser_map.hpp index 3c4d587..60e3a77 100644 --- a/chaos/src/ikeda_laser_map.hpp +++ b/chaos/src/ikeda_laser_map.hpp @@ -32,11 +32,10 @@ // taken from Willi-Hans Steeb: Chaos and Fractals class ikeda_laser_map: - public map_base + public map_base<1> { public: - ikeda_laser_map(): - map_base(1) + ikeda_laser_map() { CHAOS_PAR_INIT(c1,0.4); CHAOS_PAR_INIT(c2,0.9); @@ -47,10 +46,6 @@ public: CHAOS_SYS_INIT(y,0.5,1); } - ~ikeda_laser_map() - { - } - virtual void m_step() { data_t x = m_data[0]; -- cgit v1.2.1 From 2c157bd8aa1f5387169cc0c0910d36c8068c4068 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Sun, 21 May 2006 19:17:04 +0000 Subject: improved inlining for maps svn path=/trunk/externals/tb/; revision=5106 --- chaos/src/ikeda_laser_map.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'chaos/src/ikeda_laser_map.hpp') diff --git a/chaos/src/ikeda_laser_map.hpp b/chaos/src/ikeda_laser_map.hpp index 60e3a77..534a9de 100644 --- a/chaos/src/ikeda_laser_map.hpp +++ b/chaos/src/ikeda_laser_map.hpp @@ -46,7 +46,7 @@ public: CHAOS_SYS_INIT(y,0.5,1); } - virtual void m_step() + void m_step() { data_t x = m_data[0]; data_t y = m_data[1]; -- cgit v1.2.1