cleaing up includes and namespace shit
This commit is contained in:
parent
91394ef042
commit
6cc3750f3b
13 changed files with 61 additions and 60 deletions
|
@ -1,13 +1,10 @@
|
||||||
#ifndef ATTRACTORKERNEL_HPP
|
#ifndef ATTRACTORKERNEL_HPP
|
||||||
#define ATTRACTORKERNEL_HPP
|
#define ATTRACTORKERNEL_HPP
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Protocol/interface, what you want
|
Protocol/interface, what you want
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class AttractorKernel {
|
class AttractorKernel {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
28
Canvas.cpp
28
Canvas.cpp
|
@ -3,8 +3,6 @@
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
//#include <cstdint>
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
#include "pngwriter/pngwriter.h"
|
#include "pngwriter/pngwriter.h"
|
||||||
|
|
||||||
|
@ -101,8 +99,8 @@ void Canvas::plot(double x, double y, unsigned int c, double intensity) {
|
||||||
I/O functions
|
I/O functions
|
||||||
*/
|
*/
|
||||||
void Canvas::output() {
|
void Canvas::output() {
|
||||||
cout << "Canvas: " << endl;
|
std::cout << "Canvas: " << std::endl;
|
||||||
cout << "Dimensions: " << width << " x " << height << " x " << num_colors << endl;
|
std::cout << "Dimensions: " << width << " x " << height << " x " << num_colors << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Canvas::output_file(const char * filename){
|
void Canvas::output_file(const char * filename){
|
||||||
|
@ -134,7 +132,7 @@ void Canvas::output_file(const char * filename){
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( n <= 10 ) {
|
if ( n <= 10 ) {
|
||||||
cout << "not enough data" << endl;
|
std::cout << "not enough data" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,13 +183,13 @@ void Canvas::output_file(const char * filename){
|
||||||
delete max_int;
|
delete max_int;
|
||||||
delete power;
|
delete power;
|
||||||
|
|
||||||
cout << "ready for writing file i suppose: " << filename << endl;
|
std::cout << "ready for writing file i suppose: " << filename << std::endl;
|
||||||
|
|
||||||
ofstream file(filename);
|
std::ofstream file(filename);
|
||||||
if ( !file ) {
|
if ( !file ) {
|
||||||
cout << "jij hebt pech, geen png voor jou" << endl;
|
std::cout << "jij hebt pech, geen png voor jou" << std::endl;
|
||||||
}
|
}
|
||||||
cout << filename << endl;
|
std::cout << filename << std::endl;
|
||||||
|
|
||||||
|
|
||||||
pngFile->close();
|
pngFile->close();
|
||||||
|
@ -212,7 +210,7 @@ void Canvas::output_file(){
|
||||||
|
|
||||||
void Canvas::output_raw(const char * filename){
|
void Canvas::output_raw(const char * filename){
|
||||||
|
|
||||||
ofstream outfile (filename, ofstream::binary);
|
std::ofstream outfile (filename, std::ofstream::binary);
|
||||||
|
|
||||||
outfile.write(reinterpret_cast<char*>(int_array), sizeof(unsigned int)*width*height*num_colors);
|
outfile.write(reinterpret_cast<char*>(int_array), sizeof(unsigned int)*width*height*num_colors);
|
||||||
|
|
||||||
|
@ -230,18 +228,18 @@ void Canvas::output_raw(){
|
||||||
}
|
}
|
||||||
|
|
||||||
void Canvas::input_raw(const char * filename){
|
void Canvas::input_raw(const char * filename){
|
||||||
ifstream infile(filename, ifstream::binary);
|
std::ifstream infile(filename, std::ifstream::binary);
|
||||||
|
|
||||||
if ( ! infile ) {
|
if ( ! infile ) {
|
||||||
cout << "poep" << endl;
|
std::cout << "poep" << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
infile.seekg (0, ios::end);
|
infile.seekg (0, std::ios::end);
|
||||||
int length = infile.tellg();
|
int length = infile.tellg();
|
||||||
infile.seekg (0, ios::beg);
|
infile.seekg (0, std::ios::beg);
|
||||||
|
|
||||||
cout << "length: " << length << " =? " << static_cast<int>(width*height*num_colors*sizeof(unsigned int)) << endl;
|
std::cout << "length: " << length << " =? " << static_cast<int>(width*height*num_colors*sizeof(unsigned int)) << std::endl;
|
||||||
|
|
||||||
infile.read (reinterpret_cast<char*>(int_array), sizeof (unsigned int)*width*height*num_colors);
|
infile.read (reinterpret_cast<char*>(int_array), sizeof (unsigned int)*width*height*num_colors);
|
||||||
}
|
}
|
||||||
|
|
36
Canvas.hpp
36
Canvas.hpp
|
@ -1,28 +1,28 @@
|
||||||
#ifndef CANVAS_HPP
|
#ifndef CANVAS_HPP
|
||||||
#define CANVAS_HPP
|
#define CANVAS_HPP
|
||||||
|
|
||||||
|
|
||||||
//#include "Vector.hpp"
|
//#include "Vector.hpp"
|
||||||
#include "Attractor.hpp"
|
#include "Attractor.hpp"
|
||||||
#include "Projector.hpp"
|
#include "Projector.hpp"
|
||||||
|
|
||||||
// TODO : Canvas class abstraheren (zodat er makkelijk verschillende soorten canvae gemaakt kunnen worden)
|
// TODO : Canvas class abstraheren (zodat er makkelijk verschillende soorten canvae gemaakt kunnen worden)
|
||||||
|
|
||||||
class Canvas{
|
class Canvas{
|
||||||
friend class Projector;
|
friend class Projector;
|
||||||
|
|
||||||
unsigned int dim;
|
unsigned int dim;
|
||||||
unsigned int width;
|
unsigned int width;
|
||||||
unsigned int height;
|
unsigned int height;
|
||||||
unsigned int num_colors;
|
unsigned int num_colors;
|
||||||
|
|
||||||
unsigned int * size;
|
unsigned int * size;
|
||||||
|
|
||||||
unsigned int * int_array;
|
unsigned int * int_array;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
double v;
|
double v;
|
||||||
|
|
||||||
Canvas(unsigned int width, unsigned int height, unsigned int num_colors = 1);
|
Canvas(unsigned int width, unsigned int height, unsigned int num_colors = 1);
|
||||||
|
|
||||||
|
@ -38,13 +38,13 @@ class Canvas{
|
||||||
//void output(Vector& point);
|
//void output(Vector& point);
|
||||||
|
|
||||||
void output_file(const char * filename);
|
void output_file(const char * filename);
|
||||||
void output_file();
|
void output_file();
|
||||||
void output_raw(const char * filename);
|
void output_raw(const char * filename);
|
||||||
void output_raw();
|
void output_raw();
|
||||||
void input_raw(const char * filename);
|
void input_raw(const char * filename);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // CANVAS_HPP
|
#endif // CANVAS_HPP
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <vector>
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
#include "Projector.hpp"
|
#include "Projector.hpp"
|
||||||
#include "Canvas.hpp"
|
#include "Canvas.hpp"
|
||||||
|
@ -66,7 +64,7 @@ void Projector::finish_range() {
|
||||||
if ( factor * dist > (double)canvas->size[i] ) {
|
if ( factor * dist > (double)canvas->size[i] ) {
|
||||||
factor = (double)canvas->size[i] / dist;
|
factor = (double)canvas->size[i] / dist;
|
||||||
//teh_size = canvas->size[i];
|
//teh_size = canvas->size[i];
|
||||||
cout << "crap for dim" << i << endl;
|
std::cout << "crap for dim" << i << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,10 +100,10 @@ void Projector::plot(const double * point) {
|
||||||
|
|
||||||
|
|
||||||
void Projector::output(){
|
void Projector::output(){
|
||||||
cout << "Projector properties: " << endl;
|
std::cout << "Projector properties: " << std::endl;
|
||||||
cout << " factor: " << factor << endl;
|
std::cout << " factor: " << factor << std::endl;
|
||||||
for ( unsigned int i = 0; i < intern_dim; i++ ) {
|
for ( unsigned int i = 0; i < intern_dim; i++ ) {
|
||||||
cout << " dimension " << i << ": offset: " << offset[i] << ", range: [" << range_min[i] << ", " << range_max[i] << "]" << endl;
|
std::cout << " dimension " << i << ": offset: " << offset[i] << ", range: [" << range_min[i] << ", " << range_max[i] << "]" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
#ifndef PROJECTOR_HPP
|
#ifndef PROJECTOR_HPP
|
||||||
#define PROJECTOR_HPP
|
#define PROJECTOR_HPP
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "Canvas.hpp"
|
|
||||||
|
|
||||||
class Canvas;
|
class Canvas;
|
||||||
|
|
||||||
|
@ -28,18 +24,18 @@ class Projector{
|
||||||
void finish_range();
|
void finish_range();
|
||||||
|
|
||||||
|
|
||||||
// TODO : Matrix gebruiken voor lineaire afbeelding
|
// TODO : Matrix gebruiken voor lineaire afbeelding
|
||||||
// TODO : Over kleuren nadenken
|
// TODO : Over kleuren nadenken
|
||||||
/*
|
/*
|
||||||
Kleurmodi:
|
Kleurmodi:
|
||||||
-genormalizeerde coordinaten als kleurintensiteit (gebruikt fp canvas)
|
-genormalizeerde coordinaten als kleurintensiteit (gebruikt fp canvas)
|
||||||
-kleurbanden, dus met een periodieke functie (gebruikt int canvas)
|
-kleurbanden, dus met een periodieke functie (gebruikt int canvas)
|
||||||
*/
|
*/
|
||||||
void project(const double * point);
|
void project(const double * point);
|
||||||
void plot(const double * point);
|
void plot(const double * point);
|
||||||
|
|
||||||
void output();
|
void output();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PROJECTOR_HPP
|
#endif // PROJECTOR_HPP
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,10 @@
|
||||||
|
|
||||||
#include "../AttractorKernel.hpp"
|
#include "../AttractorKernel.hpp"
|
||||||
|
|
||||||
|
/*
|
||||||
|
This is a partial default implementation of the abstract AttractorKernel class
|
||||||
|
you can easily use the constructor to initialise the parameters and stuff...
|
||||||
|
*/
|
||||||
class KernelBasicParameter : virtual public AttractorKernel {
|
class KernelBasicParameter : virtual public AttractorKernel {
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,10 @@
|
||||||
|
|
||||||
#include "../AttractorKernel.hpp"
|
#include "../AttractorKernel.hpp"
|
||||||
|
|
||||||
|
/*
|
||||||
|
This is a partial default implementation of the abstract AttractorKernel class
|
||||||
|
you can easily use the constructor to initialise the vectors and stuff...
|
||||||
|
*/
|
||||||
class KernelBasicVector : virtual public AttractorKernel {
|
class KernelBasicVector : virtual public AttractorKernel {
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "Logistic.hpp"
|
#include "Logistic.hpp"
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
Logistic::Logistic():
|
Logistic::Logistic():
|
||||||
KernelBasicParameter(3),
|
KernelBasicParameter(3),
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "Lorenz3D.hpp"
|
#include "Lorenz3D.hpp"
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
Lorenz3D::Lorenz3D():
|
Lorenz3D::Lorenz3D():
|
||||||
KernelBasicParameter(4),
|
KernelBasicParameter(4),
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "Polynomial.hpp"
|
#include "Polynomial.hpp"
|
||||||
|
#include <algorithm>
|
||||||
//#include <iostream>
|
//#include <iostream>
|
||||||
|
|
||||||
Polynomial::Polynomial():
|
Polynomial::Polynomial():
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "PolynomialA3D.hpp"
|
#include "PolynomialA3D.hpp"
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
PolynomialA3D::PolynomialA3D():
|
PolynomialA3D::PolynomialA3D():
|
||||||
KernelBasicParameter(3),
|
KernelBasicParameter(3),
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "Unravel3D.hpp"
|
#include "Unravel3D.hpp"
|
||||||
|
#include <algorithm>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
Unravel3D::Unravel3D():
|
Unravel3D::Unravel3D():
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
#define MYMATH_HPP
|
#define MYMATH_HPP
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
bool even(double x) {
|
bool even(double x) {
|
||||||
return (((int)floor(x)) % 2 == 0);
|
return (((int)floor(x)) % 2 == 0);
|
||||||
|
|
Reference in a new issue