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.
65 lines
1.7 KiB
65 lines
1.7 KiB
//
|
|
// $filename
|
|
// $projectname
|
|
//
|
|
// Created by Joshua moerman on $TODAY.
|
|
// Copyright 2010 Joshua Moerman. All rights reserved.
|
|
//
|
|
|
|
#include "PolynomialA3D.hpp"
|
|
|
|
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) {
|
|
|
|
}
|
|
|
|
unsigned int PolynomialA3D::getNumberOfParameters() {
|
|
return numberOfParameters;
|
|
}
|
|
|