Browse Source

added new attractor

master
Joshua Moerman 14 years ago
parent
commit
1db05a3187
  1. 8
      AttractorKernel.cpp
  2. 8
      attractors/emptyUnravelHeart3D.stf
  3. 2
      batch.sh
  4. 37
      kernels/UnravelHeart3D.hpp

8
AttractorKernel.cpp

@ -13,6 +13,7 @@
#include "kernels/Polynomial.hpp"
#include "kernels/PolynomialA3D.hpp"
#include "kernels/Unravel3D.hpp"
#include "kernels/UnravelHeart3D.hpp"
#include "kernels/Ikeda3D.hpp"
AttractorKernel* AttractorKernel::createAttractorKernel(stfu::node& attractor) {
@ -62,6 +63,13 @@ AttractorKernel* AttractorKernel::createAttractorKernel(stfu::node& attractor) {
LogError("something wrong\n");
exit(37);
}
} else if(attractorType == "unravel heart") {
if(dimension == 3) {
myAttractor = new UnravelHeart3D();
} else {
LogError("something wrong\n");
exit(37);
}
} else if(attractorType == "ikeda") {
if(dimension == 3) {
myAttractor = new Ikeda3D();

8
attractors/emptyUnravelHeart3D.stf

@ -0,0 +1,8 @@
AttractorKernel: {
type: "unravel heart"
dimensions: "3"
}
Projector: "Projector"
Projector: {
}

2
batch.sh

@ -1,2 +1,2 @@
#!/bin/bash
while true; do ./AwesomeAttractor -P /var/www/joshua/render/lomp/ -R -I 10000 -W 100 -H 100 -v attractors/emptyUnravel3D.stf; done
while true; do ./bin/Release/AwesomeAttractor -R -I 10 -W 400 -H 400 -v attractors/emptyUnravelHeart3D.stf; done

37
kernels/UnravelHeart3D.hpp

@ -0,0 +1,37 @@
#ifndef UNRAVELHEART3D_HPP
#define UNRAVELHEART3D_HPP
#include "../AttractorKernel.hpp"
#include <cmath>
class UnravelHeart3D : public AttractorKernel {
public:
UnravelHeart3D():
AttractorKernel(3, 8) {}
virtual std::string type() { return "unravel heart"; };
virtual void operator()() {
std::swap(vectorNew, vectorOld);
vectorNew[0] = parameters[0]*(vectorOld[2] + parameters[1]);
vectorNew[1] = parameters[2]*(vectorOld[0] + parameters[3]);
vectorNew[2] = parameters[4]*(vectorOld[1] + parameters[5]);
const double dist = vectorNew[0]*vectorNew[0] + vectorNew[1]*vectorNew[1] + 2.0*vectorNew[2]*vectorNew[2];
if(parameters[7] * dist - parameters[7] > vectorNew[0]*vectorNew[0]*vectorNew[1]*vectorNew[1]*vectorNew[1]) {
const double sqrtDist = std::sqrt(dist);
const double p = 1.0 - parameters[6] * (static_cast<int>(sqrtDist / parameters[6]) + 1.0) / sqrtDist;
vectorNew[0] *= p;
vectorNew[1] *= p;
vectorNew[2] *= p;
}
}
};
#endif // UNRAVEL_HPP