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.
 
 
 

75 lines
1.8 KiB

//
// $filename
// $projectname
//
// Created by Joshua moerman on $TODAY.
// Copyright 2010 Joshua Moerman. All rights reserved.
//
const static unsigned int dimension = 3;
const static unsigned int numberOfParameters = 3;
PolynomialA3D::PolynomialA3D() {
init();
}
void PolynomialA3D::init() {
myParameters = new double[numberOfParameters];
vectorNew = new double[dimension];
vectorOld = new double[dimension];
assert(myParameters != NULL);
assert(vectorNew != NULL);
assert(vectorOld != NULL);
for ( unsigned int i = 0; i < numberOfParameters; i++ ) {
myParameters[i] = 0.0;
}
for ( unsigned int i = 0; i < dimension; i++ ) {
vectorNew[i] = vectorOld[i] = 0.0;
}
}
void PolynomialA3D::iterate() {
swap(vectorNew, vectorOld);
vectorNew[0] = myParameters[0] + vectorOld[1] - vectorOld[1]*vectorOld[2];
vectorNew[1] = myParameters[1] + vectorOld[2] - vectorOld[2]*vectorOld[0];
vectorNew[2] = myParameters[2] + vectorOld[0] - vectorOld[0]*vectorOld[1];
}
/*
N dimensional:
for ( unsigned int i = 0; i < dim; i++ ) {
new_point[i] = param[i] + point[(i+1) % dim] - point[(i+1) % dim]*point[(i+2) % dim];
}
*/
// setters, getters, all i/o to other classes/objects
void * PolynomialA3D::getProperty(const string identifier) {
if ( identifier == "dimension" ) {
unsigned int * _return = new unsigned int;
*_return = dimension;
return _return;
}
return NULL;
}
void PolynomialA3D::setProperty(const string identifier, const void * _value) {
}
double * & PolynomialA3D::parameters() {
return myParameters;
}
double & PolynomialA3D::parameter(const unsigned int index) {
return myParameters[index];
}
double * & PolynomialA3D::vector() {
return vectorNew;
}
double * & PolynomialA3D::previousVector() {
return vectorOld;
}