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.

42 lines
899 B

14 years ago
#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, 1) {
init();
}
virtual std::string type() { return "ikeda"; };
virtual void generate_random_parameters() {
parameters[0] = rand() / double(RAND_MAX) *2.0 - 0.5;
init();
}
virtual void operator()() {
std::swap(vectorNew, vectorOld);
vectorOld[2] = 0.4 - 6.0/(1 + vectorOld[0]*vectorOld[0] + vectorOld[1]*vectorNew[1]);
vectorNew[0] = 1 + parameters[0] * (vectorOld[0]*cos(vectorOld[2]) - vectorOld[1]*sin(vectorOld[2]));
vectorNew[0] = parameters[0] * (vectorOld[0]*sin(vectorOld[2]) + vectorOld[1]*cos(vectorOld[2]));
}
};
#endif // IKEDA3D_HPP