My old project for strange attractors
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 

44 lines
1.1 KiB

#ifndef IKEDA3D_HPP
#define IKEDA3D_HPP
#include "../AttractorKernel.hpp"
#include <algorithm>
class Ikeda3D : public AttractorKernel {
private:
void init() {
// setting some starting values
std::fill_n(vectorOld, dimension, 0.5);
std::fill_n(vectorNew, dimension, 0.5);
}
public:
Ikeda3D():
AttractorKernel(3, 4) {
init();
}
virtual std::string type() { return "ikeda"; };
virtual void generate_random_parameters() {
parameters[0] = rand() / double(RAND_MAX) *2.0 - 0.5;
parameters[1] = rand() / double(RAND_MAX) *2.0 - 0.5; // wikipedia: u
parameters[2] = rand() / double(RAND_MAX) *2.0 - 0.5;
parameters[3] = rand() / double(RAND_MAX) *30.0;
init();
}
virtual void operator()() {
std::swap(vectorNew, vectorOld);
vectorOld[2] = parameters[2] - parameters[3]/(1 + vectorOld[0]*vectorOld[0] + vectorOld[1]*vectorNew[1]);
vectorNew[0] = parameters[0] + parameters[1] * (vectorOld[0]*cos(vectorOld[2]) - vectorOld[1]*sin(vectorOld[2]));
vectorNew[1] = parameters[1] * (vectorOld[0]*sin(vectorOld[2]) + vectorOld[1]*cos(vectorOld[2]));
}
};
#endif // IKEDA3D_HPP