|
|
|
#include "Lorenz3D.hpp"
|
|
|
|
#include <algorithm>
|
|
|
|
|
|
|
|
|
|
|
|
#pragma mark -
|
|
|
|
#pragma mark ctors
|
|
|
|
|
|
|
|
Lorenz3D::Lorenz3D():
|
|
|
|
AttractorKernel(3, 4){
|
|
|
|
init();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Lorenz3D::init() {
|
|
|
|
// setting some starting values
|
|
|
|
std::fill_n(vectorOld, dimension, 1.0);
|
|
|
|
std::fill_n(vectorNew, dimension, 1.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#pragma mark -
|
|
|
|
#pragma mark attractor
|
|
|
|
|
|
|
|
void Lorenz3D::operator()() {
|
|
|
|
std::swap(vectorNew, vectorOld);
|
|
|
|
|
|
|
|
vectorNew[0] = vectorOld[0] + parameters[0] * parameters[1] * (vectorOld[1] - vectorOld[0]);
|
|
|
|
vectorNew[1] = vectorOld[1] + parameters[0] * (vectorOld[0] * (parameters[2] - vectorOld[2]) - vectorOld[1]);
|
|
|
|
vectorNew[2] = vectorOld[2] + parameters[0] * (vectorOld[0] * vectorOld[1] - parameters[3] * vectorOld[2]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
4D:
|
|
|
|
new_point[0] = point[0] + param[0] * param[1] * (point[1] - point[0]);
|
|
|
|
new_point[1] = point[1] + param[0] * (point[0] * (param[2] - point[2]) - point[1] + point[3]);
|
|
|
|
new_point[2] = point[2] + param[0] * (point[0] * point[1] - param[3] * point[2]);
|
|
|
|
new_point[3] = point[3] - param[0] * param[4] * point[0];
|
|
|
|
break;
|
|
|
|
*/
|
|
|
|
|