From c75c17685a646e90d772c2d6ea4de7c2d0d250b6 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Sun, 9 Oct 2022 12:51:01 +0100 Subject: new plugin chooser --- gui/src/ofApp.cpp | 2 +- pluginchooser/Makefile | 13 ++ pluginchooser/addons.make | 2 + pluginchooser/config.make | 142 +++++++++++++++++++++ pluginchooser/src/main.cpp | 19 +++ pluginchooser/src/ofApp.cpp | 61 +++++++++ pluginchooser/src/ofApp.h | 27 ++++ pluginchooser/src/ofxAChaosLib/LICENSE | 11 ++ pluginchooser/src/ofxAChaosLib/README.md | 71 +++++++++++ pluginchooser/src/ofxAChaosLib/src/AChaosBaker.h | 66 ++++++++++ pluginchooser/src/ofxAChaosLib/src/AChaosBase.h | 76 +++++++++++ .../src/ofxAChaosLib/src/AChaosClifford.h | 66 ++++++++++ pluginchooser/src/ofxAChaosLib/src/AChaosCollatz.h | 59 +++++++++ pluginchooser/src/ofxAChaosLib/src/AChaosDuffing.h | 58 +++++++++ pluginchooser/src/ofxAChaosLib/src/AChaosGinger.h | 56 ++++++++ pluginchooser/src/ofxAChaosLib/src/AChaosHenon.h | 53 ++++++++ pluginchooser/src/ofxAChaosLib/src/AChaosHenonF.h | 76 +++++++++++ .../src/ofxAChaosLib/src/AChaosHenonHeilles.h | 62 +++++++++ .../src/ofxAChaosLib/src/AChaosHenonPhase.h | 59 +++++++++ pluginchooser/src/ofxAChaosLib/src/AChaosIkeda.h | 63 +++++++++ pluginchooser/src/ofxAChaosLib/src/AChaosJong.h | 64 ++++++++++ .../src/ofxAChaosLib/src/AChaosLogistic.h | 44 +++++++ .../src/ofxAChaosLib/src/AChaosLogistic1.h | 46 +++++++ pluginchooser/src/ofxAChaosLib/src/AChaosLorenz.h | 84 ++++++++++++ .../src/ofxAChaosLib/src/AChaosLorenzEuler.h | 70 ++++++++++ .../src/ofxAChaosLib/src/AChaosLyapunov.h | 70 ++++++++++ .../src/ofxAChaosLib/src/AChaosNavierStokes.h | 94 ++++++++++++++ .../src/ofxAChaosLib/src/AChaosNavierStokesEuler.h | 74 +++++++++++ pluginchooser/src/ofxAChaosLib/src/AChaosRossler.h | 75 +++++++++++ pluginchooser/src/ofxAChaosLib/src/AChaosStein.h | 47 +++++++ pluginchooser/src/ofxAChaosLib/src/AChaosStein1.h | 45 +++++++ pluginchooser/src/ofxAChaosLib/src/AChaosTorus.h | 51 ++++++++ .../src/ofxAChaosLib/src/AChaosVerhulst.h | 47 +++++++ pluginchooser/src/ofxAChaosLib/src/ofxAChaosLib.h | 32 +++++ pluginchooser/src/pluginpanel.h | 99 ++++++++++++++ 35 files changed, 1983 insertions(+), 1 deletion(-) create mode 100644 pluginchooser/Makefile create mode 100644 pluginchooser/addons.make create mode 100644 pluginchooser/config.make create mode 100644 pluginchooser/src/main.cpp create mode 100644 pluginchooser/src/ofApp.cpp create mode 100644 pluginchooser/src/ofApp.h create mode 100644 pluginchooser/src/ofxAChaosLib/LICENSE create mode 100644 pluginchooser/src/ofxAChaosLib/README.md create mode 100644 pluginchooser/src/ofxAChaosLib/src/AChaosBaker.h create mode 100644 pluginchooser/src/ofxAChaosLib/src/AChaosBase.h create mode 100755 pluginchooser/src/ofxAChaosLib/src/AChaosClifford.h create mode 100644 pluginchooser/src/ofxAChaosLib/src/AChaosCollatz.h create mode 100644 pluginchooser/src/ofxAChaosLib/src/AChaosDuffing.h create mode 100644 pluginchooser/src/ofxAChaosLib/src/AChaosGinger.h create mode 100644 pluginchooser/src/ofxAChaosLib/src/AChaosHenon.h create mode 100644 pluginchooser/src/ofxAChaosLib/src/AChaosHenonF.h create mode 100644 pluginchooser/src/ofxAChaosLib/src/AChaosHenonHeilles.h create mode 100644 pluginchooser/src/ofxAChaosLib/src/AChaosHenonPhase.h create mode 100644 pluginchooser/src/ofxAChaosLib/src/AChaosIkeda.h create mode 100644 pluginchooser/src/ofxAChaosLib/src/AChaosJong.h create mode 100644 pluginchooser/src/ofxAChaosLib/src/AChaosLogistic.h create mode 100644 pluginchooser/src/ofxAChaosLib/src/AChaosLogistic1.h create mode 100644 pluginchooser/src/ofxAChaosLib/src/AChaosLorenz.h create mode 100644 pluginchooser/src/ofxAChaosLib/src/AChaosLorenzEuler.h create mode 100644 pluginchooser/src/ofxAChaosLib/src/AChaosLyapunov.h create mode 100644 pluginchooser/src/ofxAChaosLib/src/AChaosNavierStokes.h create mode 100644 pluginchooser/src/ofxAChaosLib/src/AChaosNavierStokesEuler.h create mode 100644 pluginchooser/src/ofxAChaosLib/src/AChaosRossler.h create mode 100644 pluginchooser/src/ofxAChaosLib/src/AChaosStein.h create mode 100644 pluginchooser/src/ofxAChaosLib/src/AChaosStein1.h create mode 100644 pluginchooser/src/ofxAChaosLib/src/AChaosTorus.h create mode 100644 pluginchooser/src/ofxAChaosLib/src/AChaosVerhulst.h create mode 100644 pluginchooser/src/ofxAChaosLib/src/ofxAChaosLib.h create mode 100644 pluginchooser/src/pluginpanel.h diff --git a/gui/src/ofApp.cpp b/gui/src/ofApp.cpp index 1683057..db57605 100644 --- a/gui/src/ofApp.cpp +++ b/gui/src/ofApp.cpp @@ -1,4 +1,4 @@ - #include "ofApp.h" +#include "ofApp.h" #include "glew.h" const ofPoint outputWindowSize=ofPoint(1200,900); diff --git a/pluginchooser/Makefile b/pluginchooser/Makefile new file mode 100644 index 0000000..177e172 --- /dev/null +++ b/pluginchooser/Makefile @@ -0,0 +1,13 @@ +# Attempt to load a config.make file. +# If none is found, project defaults in config.project.make will be used. +ifneq ($(wildcard config.make),) + include config.make +endif + +# make sure the the OF_ROOT location is defined +ifndef OF_ROOT + OF_ROOT=$(realpath ../../..) +endif + +# call the project makefile! +include $(OF_ROOT)/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk diff --git a/pluginchooser/addons.make b/pluginchooser/addons.make new file mode 100644 index 0000000..909ff64 --- /dev/null +++ b/pluginchooser/addons.make @@ -0,0 +1,2 @@ +ofxGui + diff --git a/pluginchooser/config.make b/pluginchooser/config.make new file mode 100644 index 0000000..469c495 --- /dev/null +++ b/pluginchooser/config.make @@ -0,0 +1,142 @@ +################################################################################ +# CONFIGURE PROJECT MAKEFILE (optional) +# This file is where we make project specific configurations. +################################################################################ + +################################################################################ +# OF ROOT +# The location of your root openFrameworks installation +# (default) OF_ROOT = ../../.. +################################################################################ + OF_ROOT = ../../openFrameworks + +################################################################################ +# PROJECT ROOT +# The location of the project - a starting place for searching for files +# (default) PROJECT_ROOT = . (this directory) +# +################################################################################ +# PROJECT_ROOT = . + +################################################################################ +# PROJECT SPECIFIC CHECKS +# This is a project defined section to create internal makefile flags to +# conditionally enable or disable the addition of various features within +# this makefile. For instance, if you want to make changes based on whether +# GTK is installed, one might test that here and create a variable to check. +################################################################################ +# None + +################################################################################ +# PROJECT EXTERNAL SOURCE PATHS +# These are fully qualified paths that are not within the PROJECT_ROOT folder. +# Like source folders in the PROJECT_ROOT, these paths are subject to +# exlclusion via the PROJECT_EXLCUSIONS list. +# +# (default) PROJECT_EXTERNAL_SOURCE_PATHS = (blank) +# +# Note: Leave a leading space when adding list items with the += operator +################################################################################ +# PROJECT_EXTERNAL_SOURCE_PATHS = + +################################################################################ +# PROJECT EXCLUSIONS +# These makefiles assume that all folders in your current project directory +# and any listed in the PROJECT_EXTERNAL_SOURCH_PATHS are are valid locations +# to look for source code. The any folders or files that match any of the +# items in the PROJECT_EXCLUSIONS list below will be ignored. +# +# Each item in the PROJECT_EXCLUSIONS list will be treated as a complete +# string unless teh user adds a wildcard (%) operator to match subdirectories. +# GNU make only allows one wildcard for matching. The second wildcard (%) is +# treated literally. +# +# (default) PROJECT_EXCLUSIONS = (blank) +# +# Will automatically exclude the following: +# +# $(PROJECT_ROOT)/bin% +# $(PROJECT_ROOT)/obj% +# $(PROJECT_ROOT)/%.xcodeproj +# +# Note: Leave a leading space when adding list items with the += operator +################################################################################ +# PROJECT_EXCLUSIONS = + +################################################################################ +# PROJECT LINKER FLAGS +# These flags will be sent to the linker when compiling the executable. +# +# (default) PROJECT_LDFLAGS = -Wl,-rpath=./libs +# +# Note: Leave a leading space when adding list items with the += operator +################################################################################ + +# Currently, shared libraries that are needed are copied to the +# $(PROJECT_ROOT)/bin/libs directory. The following LDFLAGS tell the linker to +# add a runtime path to search for those shared libraries, since they aren't +# incorporated directly into the final executable application binary. +# TODO: should this be a default setting? +# PROJECT_LDFLAGS=-Wl,-rpath=./libs + +################################################################################ +# PROJECT DEFINES +# Create a space-delimited list of DEFINES. The list will be converted into +# CFLAGS with the "-D" flag later in the makefile. +# +# (default) PROJECT_DEFINES = (blank) +# +# Note: Leave a leading space when adding list items with the += operator +################################################################################ +# PROJECT_DEFINES = + +################################################################################ +# PROJECT CFLAGS +# This is a list of fully qualified CFLAGS required when compiling for this +# project. These CFLAGS will be used IN ADDITION TO the PLATFORM_CFLAGS +# defined in your platform specific core configuration files. These flags are +# presented to the compiler BEFORE the PROJECT_OPTIMIZATION_CFLAGS below. +# +# (default) PROJECT_CFLAGS = (blank) +# +# Note: Before adding PROJECT_CFLAGS, note that the PLATFORM_CFLAGS defined in +# your platform specific configuration file will be applied by default and +# further flags here may not be needed. +# +# Note: Leave a leading space when adding list items with the += operator +################################################################################ +# PROJECT_CFLAGS = + +################################################################################ +# PROJECT OPTIMIZATION CFLAGS +# These are lists of CFLAGS that are target-specific. While any flags could +# be conditionally added, they are usually limited to optimization flags. +# These flags are added BEFORE the PROJECT_CFLAGS. +# +# PROJECT_OPTIMIZATION_CFLAGS_RELEASE flags are only applied to RELEASE targets. +# +# (default) PROJECT_OPTIMIZATION_CFLAGS_RELEASE = (blank) +# +# PROJECT_OPTIMIZATION_CFLAGS_DEBUG flags are only applied to DEBUG targets. +# +# (default) PROJECT_OPTIMIZATION_CFLAGS_DEBUG = (blank) +# +# Note: Before adding PROJECT_OPTIMIZATION_CFLAGS, please note that the +# PLATFORM_OPTIMIZATION_CFLAGS defined in your platform specific configuration +# file will be applied by default and further optimization flags here may not +# be needed. +# +# Note: Leave a leading space when adding list items with the += operator +################################################################################ +# PROJECT_OPTIMIZATION_CFLAGS_RELEASE = +# PROJECT_OPTIMIZATION_CFLAGS_DEBUG = + +################################################################################ +# PROJECT COMPILERS +# Custom compilers can be set for CC and CXX +# (default) PROJECT_CXX = (blank) +# (default) PROJECT_CC = (blank) +# Note: Leave a leading space when adding list items with the += operator +################################################################################ +# PROJECT_CXX = +# PROJECT_CC = diff --git a/pluginchooser/src/main.cpp b/pluginchooser/src/main.cpp new file mode 100644 index 0000000..d9d6188 --- /dev/null +++ b/pluginchooser/src/main.cpp @@ -0,0 +1,19 @@ +#include "ofMain.h" +#include "ofApp.h" + +int main(int argc, char *argv[]){ + ofGLFWWindowSettings settings; + settings.decorated = true; + settings.setSize(400,400); + settings.setPosition(ofVec2f(100,100)); + settings.resizable = false; + + shared_ptr mainWindow = ofCreateWindow(settings); + mainWindow->setVerticalSync(false); + + shared_ptr mainApp(new ofApp); + + ofRunApp(mainWindow, mainApp); + ofRunMainLoop(); +} + \ No newline at end of file diff --git a/pluginchooser/src/ofApp.cpp b/pluginchooser/src/ofApp.cpp new file mode 100644 index 0000000..1980be4 --- /dev/null +++ b/pluginchooser/src/ofApp.cpp @@ -0,0 +1,61 @@ +#include "ofApp.h" +#include "glew.h" +#include "pluginpanel.h" + +//-------------------------------------------------------------- +void ofApp::setup(){ + + ofSetFrameRate(60); + + plugingui.setup("chaos","",10,10); + +} + +void ofApp::update(){ + +} + +void ofApp::draw(){ + ofBackground(0); + + ofSetColor(255); + ofNoFill(); + + plugingui.draw(); + +} + +void ofApp::exit() { +} + +void ofApp::keyPressed(ofKeyEventArgs &args){ + +} + + +void ofApp::keyReleased(ofKeyEventArgs &args){ +} + +void ofApp::mouseMoved(int x, int y ){ +} + +void ofApp::mouseDragged(int x, int y, int button){ +} + +void ofApp::mousePressed(int x, int y, int button){ +} + +void ofApp::mouseReleased(int x, int y, int button){ +} + +void ofApp::mouseEntered(int x, int y){ +} + +void ofApp::mouseExited(int x, int y){ +} + +void ofApp::windowResized(int w, int h){ +} + +void ofApp::dragEvent(ofDragInfo dragInfo){ +} diff --git a/pluginchooser/src/ofApp.h b/pluginchooser/src/ofApp.h new file mode 100644 index 0000000..8d716c1 --- /dev/null +++ b/pluginchooser/src/ofApp.h @@ -0,0 +1,27 @@ +#pragma once + +#include "ofMain.h" +#include "pluginpanel.h" + +class ofApp: public ofBaseApp{ + + public: + void setup(); + void update(); + void draw(); + void exit(); + + void keyPressed(ofKeyEventArgs &keyargs); + void keyReleased(ofKeyEventArgs & args); + void mouseMoved(int x, int y ); + void mouseDragged(int x, int y, int button); + void mousePressed(int x, int y, int button); + void mouseReleased(int x, int y, int button); + void mouseEntered(int x, int y); + void mouseExited(int x, int y); + void windowResized(int w, int h); + void dragEvent(ofDragInfo dragInfo); + + pluginPanel plugingui; + +}; diff --git a/pluginchooser/src/ofxAChaosLib/LICENSE b/pluginchooser/src/ofxAChaosLib/LICENSE new file mode 100644 index 0000000..3538376 --- /dev/null +++ b/pluginchooser/src/ofxAChaosLib/LICENSE @@ -0,0 +1,11 @@ +The MIT License (MIT) + +Copyright (c) 2004,2015 AndrĂ© Sier +Copyright (c) 1996 Richard Dudas + + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/pluginchooser/src/ofxAChaosLib/README.md b/pluginchooser/src/ofxAChaosLib/README.md new file mode 100644 index 0000000..4916cd6 --- /dev/null +++ b/pluginchooser/src/ofxAChaosLib/README.md @@ -0,0 +1,71 @@ +/* + 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 +*/ + +This A-Chaos Lib extends a tiny bit Richard Dudas' original "ChaosCollectionFAT" from October 1996 on the Max Programming Environment. + +A-Chaos Lib 1.01 +(a chaotic library for max systems / march 2004 (ppc+9) / jan 2005 (win)/ jun 2006 (ub)) + + +A-Chaos Lib is a library of non-linear strange attractors for the max programming environment extended from Richard Dudas' Chaos Collection, including the source. + + +(24 dynamic non-linear systems :: a-baker, a-clifford, a-collatz, a-duffing, a-fibonacci, a-ginger, a-henon-heilles, a-henon, a-henonf, a-henonphase, a-ikeda, a-jong, a-logistic, a-logistic1, a-lorenz, a-lorenz.e,a-lyapunov, a-navier-stokes, a-navier-stokes.e, a-rossler, a-stein, a-stein1, a-torus and a-verhulst) + +A-Chaos Lib web page +http://s373.net/code/A-Chaos-Lib/A-Chaos.html + + +Below you can find the original README from Richard Dudas. I asked Richard Dudas for permission to extend his collection, circa 2003+, after being immersed doing c.( ) (a 2h movie and an audio cd, still unreleased). + +http://andre-sier.com/projects/c-lv-copy/ +http://andre-sier.com/projects/c/ + +-AndrĂ© Sier (astronaut@s373.net) + + + + Chaos Collection (first release October 1996) + + The Chaos Collection is a suite of Max (Macintosh) External Objects which generate numeric values according to theories of certain non-linear dynamic systems: iterations of recursive equations and solutions of differential equations. These objects are "Fat" - they contain code for both 68k and PowerPC versions of Max. + + Those who are familiar with IRCAM's software "PatchWork" will recognize that these objects correspond to those included in the Orbitals section of PatchWork's Chaos Library written by Mikhail Malt. It was Mikhail's enthusiasm and support for my desire to convert this library to the real-time environment of Max that helped get the initial project off the ground. + + Many of the objects include abstraction versions (denoted bu the suffix ".a"). These versions are not intended to be used in practical situations, but rather to be studied; they are provided as an aid to understanding the computational processes on which the external objects are based. In general, the abstraction versions function similarly to the actual external objects which they represent, but may contain slight differences such as the messages they accept, the order of the inlets, etc... + + The objects and abstractions share a similar naming convention: + their names all begin with "chaos-" + + The External Objects themselves share a common interface: + a "bang" in the left inlet calculates an iteration of the equation + the equation's initial values may be set by sending an int or float to any one of the inlets + (a number in the leftmost inlet will also trigger the calculation) + the "set" message in the left inlet may also be used to set the initial values + (the "set" message will not trigger the calculation) + the "reset" message in the left inlet will reset the object's last initial values + the "info" message will display all current and initial valuers in the Max window + + The .help files provided also share a common user-interface. + a "metro" object is used to trigger a stream of calculations + The calculations are displayed graphically - so there's no sound !! + (the object's output is sent to a multislider or lcd depending on the object) + The lcd object may be cleared using the "clear" message provided. + (in some cases the scale of the display may be changed) + + Many of the equations used are very sensitive and require numbers within a specific range. No attempt has been made to prevent you from throwing these chaotic systems out of balance. + So, if one set of values doesn't work, try another! + A larger, more informative manual will hopefully be provided with the next release of the Chaos Collection. (You may want to refer to the PatchWork Chaos Library's documentation.) + + Caveats: + You may want to disable overdrive or change the speed of the metro when using Max 3.0 or earlier!!! The lcd object provided with these versions of Max tends to crash on fast machines. This problem has been fixed in the lcd which comes with Max 3.5. + + Although these objects are provided "as-is", bug reports are most certainly welcome. + + -Richard Dudas (dudas@ircam.fr) + + diff --git a/pluginchooser/src/ofxAChaosLib/src/AChaosBaker.h b/pluginchooser/src/ofxAChaosLib/src/AChaosBaker.h new file mode 100644 index 0000000..8c5175a --- /dev/null +++ b/pluginchooser/src/ofxAChaosLib/src/AChaosBaker.h @@ -0,0 +1,66 @@ +/* + 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 AChaosBaker : public AChaosBase { +public: + + REAL eval, init; + bool fold_cut; + + AChaosBaker(){} + ~AChaosBaker(){} + + vector param_labels={"","init"}; + + virtual vector &get_param_labels(){return this->param_labels;}; + + virtual void setup(REAL * params = NULL){ + AChaosBase::init(params, 2, 1); + + if(params==NULL){ + eval = 0.85f; + init = 0.85f; + fold_cut = false; + REAL p[2] = {init,(REAL)fold_cut}; + set(p); + } else { + set(params); + } + + } + + void reset(){ + init = iv[0]; + fold_cut = iv[1] > 0.0f; + eval = init; + } + + void calc(){ + + if (!fold_cut) /* fold */ + { + if (eval > 0.5) + eval = 2. - (eval*2.); + else + eval *= 2.; + } + else /* cut */ + { + if (eval < 0.5) + eval *= 2.; + else + eval = (eval*2.) - 1.; + } + + ov[0] = eval; + + } +}; diff --git a/pluginchooser/src/ofxAChaosLib/src/AChaosBase.h b/pluginchooser/src/ofxAChaosLib/src/AChaosBase.h new file mode 100644 index 0000000..b6ef5e3 --- /dev/null +++ b/pluginchooser/src/ofxAChaosLib/src/AChaosBase.h @@ -0,0 +1,76 @@ +/* + 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 + +// comment for 64bits version (not all objects support) +#define ACHAOS_parameters + +#ifdef ACHAOS_paramaters +#include "ofMain.h" + typedef ofParameter REAL + #define SIN sin + #define COS cos + +#elif ACHAOS32 +// 32bit + typedef float REAL; + #define SIN sinf + #define COS cosf + +#else +// 64bit + typedef double REAL; + #define SIN sin + #define COS cos + +#endif + + + +class AChaosBase { +public: + AChaosBase(){}; + ~AChaosBase(){} + + vector iv; + vector ov; + + virtual void setup(REAL * params = NULL)=0; + + virtual vector &get_param_labels()=0; + + void init(REAL * params = NULL, int numiv=1, int numov=1){ + iv.clear(); + ov.clear(); + for(int i=0; i ¶ms){ + iv.clear(); + for(int i=0; i & getVec(){return ov;} +}; \ No newline at end of file diff --git a/pluginchooser/src/ofxAChaosLib/src/AChaosClifford.h b/pluginchooser/src/ofxAChaosLib/src/AChaosClifford.h new file mode 100755 index 0000000..ab52473 --- /dev/null +++ b/pluginchooser/src/ofxAChaosLib/src/AChaosClifford.h @@ -0,0 +1,66 @@ +/* + 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" + +#define clif_calc(a,b,c,d) (SIN((a)*(b))+(c)*COS((a)*(d))) + +class AChaosClifford : public AChaosBase { +public: + + REAL a, b, c, d, nx, ny; + + AChaosClifford(){} + ~AChaosClifford(){} + + vector param_labels={"a","b","c","d","",""}; + virtual vector &get_param_labels(){return this->param_labels;}; + + virtual void setup(REAL * params = NULL){ + + ofLog()<<"inherited setup for Baker "; + + AChaosBase::init(params, 6,2); + if(params==NULL){ + //init + a = -1.4f; + b = 1.6f; + c = 1.0f; + d = 0.7f; + //do not init x and y for more chaotic results + nx = 0.0f; + ny = 0.0f; + + REAL p[6] = {a,b,c,d,nx,ny}; + set(p); + } else { + set(params); + } + + } + + void reset(){ + a = iv[0]; + b = iv[1]; + c = iv[2]; + d = iv[3]; + nx = iv[4]; + ny = iv[5]; + } + + void calc(){ + // clifford attractor + // lx1 = sin (a*ny) + c*cos(a*nx); + // ly1 = sin (b*nx) + d*cos(b*ny); + nx = clif_calc(a, ny, c, nx); + ny = clif_calc(b, nx, d, ny); + + ov[0] = nx; + ov[1] = ny; + } +}; \ No newline at end of file diff --git a/pluginchooser/src/ofxAChaosLib/src/AChaosCollatz.h b/pluginchooser/src/ofxAChaosLib/src/AChaosCollatz.h new file mode 100644 index 0000000..d7b1c00 --- /dev/null +++ b/pluginchooser/src/ofxAChaosLib/src/AChaosCollatz.h @@ -0,0 +1,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 AChaosCollatz : public AChaosBase { +public: + + long value, offset; + bool mode; + + + AChaosCollatz(){} + ~AChaosCollatz(){} + + vector param_labels={"","offset"}; + virtual vector &get_param_labels(){return this->param_labels;}; + + virtual void setup(REAL * params = NULL){ + AChaosBase::init(params, 3, 1); + + if(params==NULL){ + //init + value = offset = 0; + mode = 0; + + REAL p[3] = {(REAL)value,(REAL)offset,(REAL)mode}; + set(p); + } else { set(params); } + } + + void reset(){ + value = (long) iv[0]; + offset = (long) iv[1]; + mode = iv[2]>0; + } + + void calc(){ + + short int stub = value % 2; //par ou impar + + if(!mode) { // L.Collatz collatz mode + if (!stub) value /= 2; //par ]e metade + else value = 3*value+1; //impar ]e 3n+1 + } + else if (mode) { // Terras collatz mode + if (!stub) value /= 2; //par ]e metade + else value = 0.5*(3*value+1); //impar ]e 1/2(3n+1) + } + + ov[0] = (REAL)value; + } +}; \ No newline at end of file diff --git a/pluginchooser/src/ofxAChaosLib/src/AChaosDuffing.h b/pluginchooser/src/ofxAChaosLib/src/AChaosDuffing.h new file mode 100644 index 0000000..f94b638 --- /dev/null +++ b/pluginchooser/src/ofxAChaosLib/src/AChaosDuffing.h @@ -0,0 +1,58 @@ +/* + 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 param_labels={"a","b","w","t","dt","",""}; + virtual vector &get_param_labels(){return this->param_labels;}; + + 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 diff --git a/pluginchooser/src/ofxAChaosLib/src/AChaosGinger.h b/pluginchooser/src/ofxAChaosLib/src/AChaosGinger.h new file mode 100644 index 0000000..f18094c --- /dev/null +++ b/pluginchooser/src/ofxAChaosLib/src/AChaosGinger.h @@ -0,0 +1,56 @@ +/* + 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 AChaosGinger : public AChaosBase { +public: + + REAL seed, nx, ny; + + AChaosGinger(){} + ~AChaosGinger(){} + + vector param_labels={"seed","",""}; + virtual vector &get_param_labels(){return this->param_labels;}; + + virtual void setup(REAL * params = NULL){ + + AChaosBase::init(params, 3, 2); + if(params==NULL){ + //init + seed = 0.82f; + nx = 0.7f; + ny = 1.2f; + + REAL p[3] = {seed,nx,ny}; + set(p); + } else { set(params); } + } + + void reset(){ + seed = iv[0]; + nx = iv[1]; + ny = iv[2]; + } + + void calc(){ + // ginger formulae + REAL x1,y1; + + y1 = nx; + if (nx<0.) nx = -nx; + x1 = 1. - ny - seed*nx; + + nx = x1; + ny = y1; + + ov[0] = nx; + ov[1] = ny; + } +}; \ No newline at end of file diff --git a/pluginchooser/src/ofxAChaosLib/src/AChaosHenon.h b/pluginchooser/src/ofxAChaosLib/src/AChaosHenon.h new file mode 100644 index 0000000..929a354 --- /dev/null +++ b/pluginchooser/src/ofxAChaosLib/src/AChaosHenon.h @@ -0,0 +1,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 param_labels={"a","b","",""}; + + AChaosHenon(){} + ~AChaosHenon(){} + virtual vector &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; + } +}; \ No newline at end of file diff --git a/pluginchooser/src/ofxAChaosLib/src/AChaosHenonF.h b/pluginchooser/src/ofxAChaosLib/src/AChaosHenonF.h new file mode 100644 index 0000000..d2a1c5a --- /dev/null +++ b/pluginchooser/src/ofxAChaosLib/src/AChaosHenonF.h @@ -0,0 +1,76 @@ +/* + 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 AChaosHenonF : public AChaosBase { +public: + + REAL a, b, nx, ny, dt, t; + + AChaosHenonF(){} + ~AChaosHenonF(){} + + vector param_labels={"a","b","","","dt","t"}; + + virtual vector &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), lx1, ly1, nx2=nx*nx; + + //henon calc + lx1 = (ny + 1) - (a * nx2); + ly1 = b * nx; + + //advance 'a' by dt _AFTER_ calculating henon + t += dt; + a *= t; + + //henon phase + nx = nx*cosa - (ny -nx2)*sina; + ny = nx*sina - (ny -nx2)*cosa; + + +/* + // henonf attractor + + lx1 = nx*cos (a) - (ny - (nx*nx))*sin(a); + ly1 = nx*sin(a) - (ny - (nx*nx))*cos(a); +*/ + + ov[0] = nx; + ov[1] = ny; + } +}; \ No newline at end of file diff --git a/pluginchooser/src/ofxAChaosLib/src/AChaosHenonHeilles.h b/pluginchooser/src/ofxAChaosLib/src/AChaosHenonHeilles.h new file mode 100644 index 0000000..6638474 --- /dev/null +++ b/pluginchooser/src/ofxAChaosLib/src/AChaosHenonHeilles.h @@ -0,0 +1,62 @@ +/* + 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 AChaosHenonHeilles : public AChaosBase { +public: + + REAL nx, ny, nxdot, nydot, e, dt; + + AChaosHenonHeilles(){} + ~AChaosHenonHeilles(){} + + vector param_labels={"","","","","e","dt"}; + virtual vector &get_param_labels(){return this->param_labels;}; + + virtual void setup(REAL * params = NULL){ + + AChaosBase::init(params, 5, 4); + if(params==NULL){ + //init + nx = 1.0f; + ny = 1.0f; + nydot = 1.4f; + e = 0.125f; + dt = 0.02; + REAL p[5] = {nx,ny, nydot,e,dt}; + set(p); + } else { set(params); } + + } + + void reset(){ + nx = iv[0]; + ny = iv[1]; + nydot = iv[2]; + e = iv[3]; + dt = iv[4]; + } + + void calc(){ + // henon_heilles_calc + REAL xdd,ydd; + + xdd = -nx-(2*nx*ny); + ydd = ny*ny -ny -(nx*nx); + nxdot += xdd*dt; + nydot += ydd*dt; + nx += nxdot*dt; + ny += nydot*dt; + + ov[0] = nx; + ov[1] = ny; + ov[2] = nxdot; + ov[3] = nydot; + } +}; \ No newline at end of file diff --git a/pluginchooser/src/ofxAChaosLib/src/AChaosHenonPhase.h b/pluginchooser/src/ofxAChaosLib/src/AChaosHenonPhase.h new file mode 100644 index 0000000..02dec0f --- /dev/null +++ b/pluginchooser/src/ofxAChaosLib/src/AChaosHenonPhase.h @@ -0,0 +1,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 param_labels={"a","b","","","dt","t"}; + virtual vector &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; + } +}; \ No newline at end of file diff --git a/pluginchooser/src/ofxAChaosLib/src/AChaosIkeda.h b/pluginchooser/src/ofxAChaosLib/src/AChaosIkeda.h new file mode 100644 index 0000000..50e5b10 --- /dev/null +++ b/pluginchooser/src/ofxAChaosLib/src/AChaosIkeda.h @@ -0,0 +1,63 @@ +/* + 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 AChaosIkeda : public AChaosBase { +public: + + REAL a, b, k, p, nx, ny; + + AChaosIkeda(){} + ~AChaosIkeda(){} + + vector param_labels={"a","b","k","p","",""}; + virtual vector &get_param_labels(){return this->param_labels;}; + + virtual void setup(REAL * params = NULL){ + + AChaosBase::init(params, 6, 2); + if(params==NULL){ + //init + a=0.85; + b=0.9; + k=0.4; + p=7.7; + nx=0; + ny=0; + REAL pa[6] = {nx,ny,a,b,k,p}; + set(pa); + } else { set(params); } + + } + + void reset(){ + nx = iv[0]; + ny = iv[1]; + a = iv[2]; + b = iv[3]; + k = iv[4]; + p = iv[5]; + } + + void calc(){ + REAL x0 = nx, y0 = ny; + REAL temp = (p/(1+x0*x0+y0*y0)); + REAL cosx = (COS(b-temp)); + REAL sinx = (SIN(b-temp)); + /* + xn+1 = a + k*( x0*cos(b-(p/(1+x0*x0+y0*y0))) - y0*sin(b-(p/(1*x0*x0+y0*y0))) ) + yn+1 = k*( x0*sin(b-(p/(1+x0*x0+y0*y0))) - y0*cos(b-(p/(1*x0*x0+y0*y0))) ) + */ + nx = a + k*(x0*cosx)-y0*sinx; + ny = k*sinx -y0*cosx; + + ov[0] = nx; + ov[1] = ny; + } +}; \ No newline at end of file diff --git a/pluginchooser/src/ofxAChaosLib/src/AChaosJong.h b/pluginchooser/src/ofxAChaosLib/src/AChaosJong.h new file mode 100644 index 0000000..f1fca64 --- /dev/null +++ b/pluginchooser/src/ofxAChaosLib/src/AChaosJong.h @@ -0,0 +1,64 @@ +/* + 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 AChaosJong : public AChaosBase { +public: + + REAL a, b, c, d, nx, ny; + + vector param_labels={"a","b","c","d","",""}; + + AChaosJong(){} + ~AChaosJong(){} + virtual vector &get_param_labels(){return this->param_labels;}; + + virtual void setup(REAL * params = NULL){ + + AChaosBase::init(params, 6, 2); + if(params==NULL){ + //init + a = 1.4f; + b = -2.3f; + c = 2.4f; + d = -2.1f; + nx = 0.0f; + ny = 0.0f; + REAL p[6] = {a,b,c,d,nx,ny}; + set(p); + } else { set(params); } + + } + + void reset(){ + a = iv[0]; + b = iv[1]; + c = iv[2]; + d = iv[3]; + nx = iv[4]; + ny = iv[5]; + } + + void calc(){ + // Peter de Jong attractor + // lx1 = sin(a*ny)-cos(b*nx); + // ly1 = sin(c*nx)-cos(d*ny); + + nx = SIN(a*ny)-COS(b*nx); + ny = SIN(c*nx)-COS(d*ny); + + ov[0] = nx; + ov[1] = ny; + + } + + + +}; diff --git a/pluginchooser/src/ofxAChaosLib/src/AChaosLogistic.h b/pluginchooser/src/ofxAChaosLib/src/AChaosLogistic.h new file mode 100644 index 0000000..298ffef --- /dev/null +++ b/pluginchooser/src/ofxAChaosLib/src/AChaosLogistic.h @@ -0,0 +1,44 @@ +/* + 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 AChaosLogistic : public AChaosBase { +public: + + REAL seed, lambda; + + AChaosLogistic(){} + ~AChaosLogistic(){} + + vector param_labels={"seed","lambda"}; + virtual vector &get_param_labels(){return this->param_labels;}; + + virtual void setup(REAL * params = NULL){ + + AChaosBase::init(params, 2, 1); + if(params==NULL){ + //init + seed = 0.777f; + lambda = 3.9f; + REAL p[2] = {seed,lambda}; + set(p); + } else { set(params); } + } + + void reset(){ + seed = iv[0]; + lambda = iv[1]; + } + + void calc(){ + seed = lambda * seed * (1.0-seed); + + ov[0] = seed; + } +}; \ No newline at end of file diff --git a/pluginchooser/src/ofxAChaosLib/src/AChaosLogistic1.h b/pluginchooser/src/ofxAChaosLib/src/AChaosLogistic1.h new file mode 100644 index 0000000..27cbd61 --- /dev/null +++ b/pluginchooser/src/ofxAChaosLib/src/AChaosLogistic1.h @@ -0,0 +1,46 @@ +/* + 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 AChaosLogistic1 : public AChaosBase { +public: + + REAL seed, lambda, gamma; + + AChaosLogistic1(){} + ~AChaosLogistic1(){} + + vector param_labels={"seed","lambda","gamma"}; + virtual vector &get_param_labels(){return this->param_labels;}; + + virtual void setup(REAL * params = NULL){ + + AChaosBase::init(params, 3, 1); + if(params==NULL){ + //init + seed = 0.777f; + lambda = 3.9f; + gamma = 3.43f; + REAL p[3] = {seed,lambda,gamma}; + set(p); + } else { set(params); } + } + + void reset(){ + seed = iv[0]; + lambda = iv[1]; + gamma = iv[2]; + } + + void calc(){ + seed = (seed*lambda) -(gamma*seed*seed); + + ov[0] = seed; + } +}; \ No newline at end of file diff --git a/pluginchooser/src/ofxAChaosLib/src/AChaosLorenz.h b/pluginchooser/src/ofxAChaosLib/src/AChaosLorenz.h new file mode 100644 index 0000000..0f1ae2f --- /dev/null +++ b/pluginchooser/src/ofxAChaosLib/src/AChaosLorenz.h @@ -0,0 +1,84 @@ +/* + 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" +#define lorx(x, y, a) (a) * ((y) - (x)); +#define lory(x, y, z, a) ((x) * ((r) - (z))) - (y); +#define lorz(x, y, z, c) ((x) * (y)) - ((z) * (c)); + +class AChaosLorenz : public AChaosBase { +public: + + REAL a, r, c, nx, ny, nz,dt; //eq variables + + vector param_labels={"a","r","c","nx","ny","nz","dt"}; + + AChaosLorenz(){} + ~AChaosLorenz(){} + virtual vector &get_param_labels(){return this->param_labels;}; + + virtual void setup(REAL * params = NULL){ + + AChaosBase::init(params, 7, 3); + if(params==NULL){ + //classic lorenz + a=10.0; + r=28.0; + c= 2.67; + nx=0.1; + ny=0.1; + nz=0.1; + dt=0.01; + REAL p[7] = {nx,ny,nz,a,r,c,dt}; + set(p); + } else { set(params); } + + } + + + + void reset(){ + nx = iv[0]; + ny = iv[1]; + nz = iv[2]; + a = iv[3]; + r = iv[4]; + c = iv[5]; + dt = iv[6]; + } + + void calc(){ + + REAL dt2, fx, fy, fz, + ffx, ffy, ffz, + dtfx, dtfy, dtfz; + + dt2 = dt/2.; + + fx = lorx (nx,ny,a); + fz = lorz(nx,ny,nz,c); + fy = lory(nx,ny,nz,r); + + dtfx = nx + (dt*fx); + dtfy = ny + (dt*fy); + dtfz = nz + (dt*fz); + + ffx = lorx (dtfx,dtfy,a); + ffz = lorz(dtfx,dtfy,dtfz,c); + ffy = lory(dtfx,dtfy,dtfz,r); + + nx += (dt2*(fx+ffx)); + ny += (dt2*(fy+ffy)); + nz += (dt2*(fz+ffz)); + + ov[0] = nx; + ov[1] = ny; + ov[2] = nz; + } +}; \ No newline at end of file diff --git a/pluginchooser/src/ofxAChaosLib/src/AChaosLorenzEuler.h b/pluginchooser/src/ofxAChaosLib/src/AChaosLorenzEuler.h new file mode 100644 index 0000000..3b3f0ec --- /dev/null +++ b/pluginchooser/src/ofxAChaosLib/src/AChaosLorenzEuler.h @@ -0,0 +1,70 @@ +/* + 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" +#define lorx(x, y, a) (a) * ((y) - (x)); +#define lory(x, y, z, a) ((x) * ((r) - (z))) - (y); +#define lorz(x, y, z, c) ((x) * (y)) - ((z) * (c)); + +class AChaosLorenzEuler : public AChaosBase { +public: + + REAL a, r, c, nx, ny, nz,dt; //eq variables + + AChaosLorenzEuler(){} + ~AChaosLorenzEuler(){} + + vector param_labels={"a","r","c","nx","ny","nz","dt"}; + virtual vector &get_param_labels(){return this->param_labels;}; + + virtual void setup(REAL * params = NULL){ + + AChaosBase::init(params, 7, 3); + if(params==NULL){ + //classic lorenz + a=10.0; + r=28.0; + c= 2.67; + nx=0.1; + ny=0.1; + nz=0.1; + dt=0.01; + REAL p[7] = {nx,ny,nz,a,r,c,dt}; + set(p); + } else { set(params); } + + } + + + void reset(){ + nx = iv[0]; + ny = iv[1]; + nz = iv[2]; + a = iv[3]; + r = iv[4]; + c = iv[5]; + dt = iv[6]; + } + + void calc(){ + REAL dx, dy, dz; + + dx = ((ny*a)-(nx*a))*dt; + dy = ((nx*r)-ny-(nx*nz))*dt; + dz = ((nx*ny)-(nz*c))*dt; + + nx += dx; + ny += dy; + nz += dz; + + ov[0] = nx; + ov[1] = ny; + ov[2] = nz; + } +}; \ No newline at end of file diff --git a/pluginchooser/src/ofxAChaosLib/src/AChaosLyapunov.h b/pluginchooser/src/ofxAChaosLib/src/AChaosLyapunov.h new file mode 100644 index 0000000..caec7ff --- /dev/null +++ b/pluginchooser/src/ofxAChaosLib/src/AChaosLyapunov.h @@ -0,0 +1,70 @@ +/* + 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" +#define lorx(x, y, a) (a) * ((y) - (x)); +#define lory(x, y, z, a) ((x) * ((r) - (z))) - (y); +#define lorz(x, y, z, c) ((x) * (y)) - ((z) * (c)); + +class AChaosLyapunov : public AChaosBase { +public: + + REAL a[6], b[6], nx, ny; + + vector param_labels={"a1","a2","a3","a4","a5","a6","b1","b2","b3","b4","b5","b6","nx","ny"}; + + AChaosLyapunov(){} + ~AChaosLyapunov(){} + virtual vector &get_param_labels(){return this->param_labels;}; + + virtual void setup(REAL * params = NULL){ + + AChaosBase::init(params, 14, 2); + if(params==NULL){ + + a[0] = -1.4f; + a[1] = 0.7f; + a[2] = -0.16f; + a[3] = -1.21f; + a[4] = 1.11f; + a[5] = -1.46f; + b[0] = -0.19f; + b[1] = 0.04f; + b[2] = 1.59f; + b[3] = 1.3f; + b[4] = 1.68f; + b[5] = 1.76f; + nx = ny = 0.0f; + REAL p[14] = {a[0],a[1],a[2],a[3],a[4],a[5], + b[0],b[1],b[2],b[3],b[4],b[5],nx,ny}; + set(p); + } else { set(params); } + + } + + void reset(){ + nx = iv[12]; + ny = iv[13]; + for(int i=0; i<6; i++){ + a[i] = iv[i]; + } + for(int i=0; i<6; i++){ + b[i] = iv[i+6]; + } + } + + void calc(){ + // maybe lyapunov attractor : quadratic eq + nx = a[0] + a[1]*nx + a[2]*nx*nx + a[3]*nx*ny + a[4]*ny + a[5]*ny*ny; + ny = b[0] + b[1]*nx + b[2]*nx*nx + b[3]*nx*ny + b[4]*ny + b[5]*ny*ny; + + ov[0] = nx; + ov[1] = ny; + } +}; \ No newline at end of file diff --git a/pluginchooser/src/ofxAChaosLib/src/AChaosNavierStokes.h b/pluginchooser/src/ofxAChaosLib/src/AChaosNavierStokes.h new file mode 100644 index 0000000..82b1aee --- /dev/null +++ b/pluginchooser/src/ofxAChaosLib/src/AChaosNavierStokes.h @@ -0,0 +1,94 @@ +/* + 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 AChaosNavierStokes : public AChaosBase { +public: + + REAL a, b, c, d, e, r, dt; + + vector param_labels={"nv","nw","nx","ny","nz","r","dt"}; + + AChaosNavierStokes(){} + ~AChaosNavierStokes(){} + virtual vector &get_param_labels(){return this->param_labels;}; + + virtual void setup(REAL * params = NULL){ + + AChaosBase::init(params, 7, 5); + + if(params==NULL){ + //classic navierstokes + a = 1.0; + b = 1.0; + c = 1.0; + d = 1.0; + e = 1.0; + r = 28.0; + dt = 0.01; + REAL p[7] = {a,b,c,d,e,r,dt}; + set(p); + } else { set(params); } + + } + + void reset(){ + a = iv[0]; + b = iv[1]; + c = iv[2]; + d = iv[3]; + e = iv[4]; + r = iv[5]; + dt = iv[6]; + } + +#define nava(a, b, c, d, e) ((-2*(a)) + (4*(b)*(c)) + (4*(d)*(e))) +#define navb(a, b, c) ((-9*(b)) + (3*(a)*(c))) +#define navc(a, b, c, r) ((-5*(c)) + (-7*(a)*(b)) + (r)) +#define navd(a, d, e) ((-5*(d)) - ((a)*(e))) +#define nave(a, d, e) ((-3*(a)*(d)) - (e)) + + void calc(){ + + REAL dt2=dt/2., afa, bfb, cfc, dfd, efe; + REAL fa, fb, fc, fd, fe; + REAL ffa, ffb, ffc, ffd, ffe; + + fa=nava(a, b, c, d, e); + fb=navb(a, b, c); + fc=navc(a, b, c, r); + fd=navd(a, d, e); + fe=nave(a, d, e); + + afa = a +(dt*fa); + bfb = b +(dt*fb); + cfc = c +(dt*fc); + dfd = d +(dt*fd); + efe = e +(dt*fe); + + ffa = nava(afa,bfb,cfc,dfd,efe); + ffb = navb(afa,bfb,cfc); + ffc = navc(afa,bfb,cfc,r); + ffd = navd(afa,dfd,efe); + ffe = nave(afa,dfd,efe); + + a += (dt2*(fa+ffa)); + b += (dt2*(fb+ffb)); + c += (dt2*(fc+ffc)); + d += (dt2*(fd+ffd)); + e += (dt2*(fe+ffe)); + + ov[0] = a; + ov[1] = b; + ov[2] = c; + ov[3] = d; + ov[4] = e; + + } +}; \ No newline at end of file diff --git a/pluginchooser/src/ofxAChaosLib/src/AChaosNavierStokesEuler.h b/pluginchooser/src/ofxAChaosLib/src/AChaosNavierStokesEuler.h new file mode 100644 index 0000000..b478c72 --- /dev/null +++ b/pluginchooser/src/ofxAChaosLib/src/AChaosNavierStokesEuler.h @@ -0,0 +1,74 @@ +/* + 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 AChaosNavierStokesEuler : public AChaosBase { +public: + + REAL a, b, c, d, e, r, dt; + + AChaosNavierStokesEuler(){} + ~AChaosNavierStokesEuler(){} + + vector param_labels={"nv","nw","nx","ny","nz","r","dt"}; + virtual vector &get_param_labels(){return this->param_labels;}; + + virtual void setup(REAL * params = NULL){ + + AChaosBase::init(params, 7, 5); + if(params==NULL){ + //classic navierstokes + a = 1.0; + b = 1.0; + c = 1.0; + d = 1.0; + e = 1.0; + r = 28.0; + dt = 0.01; + REAL p[7] = {a,b,c,d,e,r,dt}; + set(p); + } else { set(params); } + + } + + void reset(){ + a = iv[0]; + b = iv[1]; + c = iv[2]; + d = iv[3]; + e = iv[4]; + r = iv[5]; + dt = iv[6]; + } + + + void calc(){ + + REAL da, db, dc, dd, de; + + da=((a * -2) + (4 * b * c) + (4 * d * e))*dt; + db=((b * -9) + (3 * a * c))*dt; + dc=((c * -5) + (-7 * a * b) + r)*dt; + dd=((d * -5) - (a * e))*dt; + de=((a * d * -3) - e)*dt; + + a += da; + b += db; + c += dc; + d += dd; + e += de; + + ov[0] = a; + ov[1] = b; + ov[2] = c; + ov[3] = d; + ov[4] = e; + + } +}; \ No newline at end of file diff --git a/pluginchooser/src/ofxAChaosLib/src/AChaosRossler.h b/pluginchooser/src/ofxAChaosLib/src/AChaosRossler.h new file mode 100644 index 0000000..e7c9fa2 --- /dev/null +++ b/pluginchooser/src/ofxAChaosLib/src/AChaosRossler.h @@ -0,0 +1,75 @@ +/* + 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" + +#define rosx(y,z) -((y)+(z)) +#define rosy(x,y,a) (x)+((a)*(y)) +#define rosz(x,z,b,c) (b)+((x)*(z))-((c)*(z)) + +class AChaosRossler : public AChaosBase { +public: + + REAL a, b, c, nx, ny, nz,dt; + + vector param_labels={"a","b","c","","","","dt"}; + + AChaosRossler(){} + ~AChaosRossler(){} + virtual vector &get_param_labels(){return this->param_labels;}; + + virtual void setup(REAL * params = NULL){ + + AChaosBase::init(params, 7, 3); + if(params==NULL){ + //classic rossler + a = 0.2; + b = 0.2; + c = 5.7; + nx = 1; + ny = 1; + nz = 1; + dt = 0.01; + REAL p[7] = {a,b,c,nx,ny,nz,dt}; + set(p); + } else { set(params); } + + } + + void reset(){ + a = iv[0]; + b = iv[1]; + c = iv[2]; + nx = iv[3]; + ny = iv[4]; + nz = iv[5]; + dt = iv[6]; + } + + + void calc(){ + REAL fx, fy, fz, ffx, ffy, ffz, dt2 = dt/2.; + REAL dtfx, dtfy, dtfz; + + fx = rosx(ny,nz); + fy = rosy(nx,ny,a); + fz = rosz(nx,nz,b,c); + + ffx = rosx((ny+dt*fy), (nz+(dt*fz))); + ffy = rosy((nx+dt*nx), (ny+dt*ny), a); + ffz = rosz((nx+dt*fx), (nz+dt*nz), b, c); + + nx += (dt2*(fx+ffx)); + ny += (dt2*(fy+ffy)); + nz += (dt2*(fz+ffz)); + + ov[0] = nx; + ov[1] = ny; + ov[2] = nz; + } +}; \ No newline at end of file diff --git a/pluginchooser/src/ofxAChaosLib/src/AChaosStein.h b/pluginchooser/src/ofxAChaosLib/src/AChaosStein.h new file mode 100644 index 0000000..b7276fb --- /dev/null +++ b/pluginchooser/src/ofxAChaosLib/src/AChaosStein.h @@ -0,0 +1,47 @@ +/* + 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" +#define pie 3.14159265358979323846 + +class AChaosStein : public AChaosBase { +public: + + REAL seed, lambda; + + AChaosStein(){} + ~AChaosStein(){} + + vector param_labels={"seed","lambda"}; + virtual vector &get_param_labels(){return this->param_labels;}; + + virtual void setup(REAL * params = NULL){ + + AChaosBase::init(params, 2, 1); + if(params==NULL){ + //init + seed = 0.777f; + lambda = 1.7f; + + REAL p[2] = {seed, lambda}; + set(p); + } else { set(params); } + } + + + void reset(){ + seed = iv[0]; + lambda = iv[1]; + } + + void calc(){ + seed = lambda * SIN(pie*seed); + + ov[0] = seed; + } +}; \ No newline at end of file diff --git a/pluginchooser/src/ofxAChaosLib/src/AChaosStein1.h b/pluginchooser/src/ofxAChaosLib/src/AChaosStein1.h new file mode 100644 index 0000000..732d32e --- /dev/null +++ b/pluginchooser/src/ofxAChaosLib/src/AChaosStein1.h @@ -0,0 +1,45 @@ +/* + 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" +#define pie 3.14159265358979323846 +class AChaosStein1 : public AChaosBase { +public: + + REAL seed, lambda; + + AChaosStein1(){} + ~AChaosStein1(){} + + vector param_labels={"","lambda"}; + virtual vector &get_param_labels(){return this->param_labels;}; + + virtual void setup(REAL * params = NULL){ + + AChaosBase::init(params, 2, 1); + if(params==NULL){ + //init + seed = 0.87f; + lambda = 2.25f; + + REAL p[2] = {seed, lambda}; + set(p); + } else { set(params); } + } + + void reset(){ + seed = iv[0]; + lambda = iv[1]; + } + + void calc(){ + seed = lambda * seed * seed * SIN(pie*seed); + + ov[0] = seed; + } +}; \ No newline at end of file diff --git a/pluginchooser/src/ofxAChaosLib/src/AChaosTorus.h b/pluginchooser/src/ofxAChaosLib/src/AChaosTorus.h new file mode 100644 index 0000000..2ab17b6 --- /dev/null +++ b/pluginchooser/src/ofxAChaosLib/src/AChaosTorus.h @@ -0,0 +1,51 @@ +/* + 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" +#define pi 3.14159265358979323846264338327950288419716939937510f +#define twopi 2.*pi +class AChaosTorus : public AChaosBase { +public: + + REAL x0, y0, cr; + + vector param_labels={"nx","ny","cr"}; + + AChaosTorus(){} + ~AChaosTorus(){} + virtual vector &get_param_labels(){return this->param_labels;}; + + virtual void setup(REAL * params = NULL){ + + AChaosBase::init(params, 3, 2); + if(params==NULL){ + //init + x0 = 0.777f; + y0 = 1.2f; + cr = 1.26f; + + REAL p[3] = {x0,y0,cr}; + set(p); + } else { set(params); } + + } + + void reset(){ + x0 = iv[0]; + y0 = iv[1]; + cr = iv[2]; + } + + void calc(){ + x0 = fmodf((x0+cr*SIN(y0)), twopi); + y0 = fmodf((x0+y0), twopi); + + ov[0] = x0; + ov[1] = y0; + } +}; \ No newline at end of file diff --git a/pluginchooser/src/ofxAChaosLib/src/AChaosVerhulst.h b/pluginchooser/src/ofxAChaosLib/src/AChaosVerhulst.h new file mode 100644 index 0000000..592df43 --- /dev/null +++ b/pluginchooser/src/ofxAChaosLib/src/AChaosVerhulst.h @@ -0,0 +1,47 @@ +/* + 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 AChaosVerhulst : public AChaosBase { +public: + + REAL seed, lambda; + + AChaosVerhulst(){} + ~AChaosVerhulst(){} + + vector param_labels={"seed","lambda"}; + virtual vector &get_param_labels(){return this->param_labels;}; + + virtual void setup(REAL * params = NULL){ + + AChaosBase::init(params, 2, 1); + if(params==NULL){ + //init + seed = 0.5f; + lambda = 2.89f; + + REAL p[2] = {seed,lambda}; + set(p); + } else { set(params); } + + + } + + void reset(){ + seed = iv[0]; + lambda = iv[1]; + } + + void calc(){ + seed = seed + (seed * lambda * (1.0-seed)); + + ov[0] = seed; + } +}; \ No newline at end of file diff --git a/pluginchooser/src/ofxAChaosLib/src/ofxAChaosLib.h b/pluginchooser/src/ofxAChaosLib/src/ofxAChaosLib.h new file mode 100644 index 0000000..3c3d712 --- /dev/null +++ b/pluginchooser/src/ofxAChaosLib/src/ofxAChaosLib.h @@ -0,0 +1,32 @@ +/* + 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 "AChaosBaker.h" +#include "AChaosClifford.h" +#include "AChaosCollatz.h" +#include "AChaosDuffing.h" +#include "AChaosGinger.h" +#include "AChaosHenon.h" +#include "AChaosHenonF.h" +#include "AChaosHenonHeilles.h" +#include "AChaosHenonPhase.h" +#include "AChaosIkeda.h" +#include "AChaosJong.h" +#include "AChaosLogistic.h" +#include "AChaosLogistic1.h" +#include "AChaosLorenz.h" +#include "AChaosLorenzEuler.h" +#include "AChaosLyapunov.h" +#include "AChaosNavierStokes.h" +#include "AChaosNavierStokesEuler.h" +#include "AChaosRossler.h" +#include "AChaosStein.h" +#include "AChaosStein1.h" +#include "AChaosTorus.h" +#include "AChaosVerhulst.h" diff --git a/pluginchooser/src/pluginpanel.h b/pluginchooser/src/pluginpanel.h new file mode 100644 index 0000000..21b9251 --- /dev/null +++ b/pluginchooser/src/pluginpanel.h @@ -0,0 +1,99 @@ +#pragma once + +#include "ofMain.h" +#include "ofxGui.h" +#include "ofxAChaoslib.h" + +class loader { +public: + loader(string _n,AChaosBase *_plugin,vector _params={}){ + name=_n; + plugin=_plugin; + params=_params; + } + string name; + AChaosBase *plugin; + vector params; +}; + +class pluginPanel : public ofxPanel { + public: + pluginPanel(){ + ofRegisterKeyEvents(this, defaultEventsPriority); + plugins={ + loader("baker",&baker), + loader("clifford",&clifford,{"a","b","c","d"}), + }; + index=0; + update(); + } + bool mouseMoved(ofMouseEventArgs & args){ + if (args.x>getPosition().x&& + args.x-getPosition().xgetPosition().y&& + args.y-getPosition().y "< "< "<().set((plugins[index].params[i], 0.0, -1.0, 1.0))); + } + } +private: + int index; + bool isSelected; + ofxLabel label; + vector plugins; + ofParameter active; + ofParameter amount; + AChaosBaker baker; + AChaosClifford clifford; +}; \ No newline at end of file -- cgit v1.2.3