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
|
||||
#define ATTRACTORKERNEL_HPP
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
/*
|
||||
Protocol/interface, what you want
|
||||
*/
|
||||
|
||||
class AttractorKernel {
|
||||
public:
|
||||
|
||||
|
|
28
Canvas.cpp
28
Canvas.cpp
|
@ -3,8 +3,6 @@
|
|||
#include <cmath>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
//#include <cstdint>
|
||||
using namespace std;
|
||||
|
||||
#include "pngwriter/pngwriter.h"
|
||||
|
||||
|
@ -101,8 +99,8 @@ void Canvas::plot(double x, double y, unsigned int c, double intensity) {
|
|||
I/O functions
|
||||
*/
|
||||
void Canvas::output() {
|
||||
cout << "Canvas: " << endl;
|
||||
cout << "Dimensions: " << width << " x " << height << " x " << num_colors << endl;
|
||||
std::cout << "Canvas: " << std::endl;
|
||||
std::cout << "Dimensions: " << width << " x " << height << " x " << num_colors << std::endl;
|
||||
}
|
||||
|
||||
void Canvas::output_file(const char * filename){
|
||||
|
@ -134,7 +132,7 @@ void Canvas::output_file(const char * filename){
|
|||
}
|
||||
|
||||
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 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 ) {
|
||||
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();
|
||||
|
@ -212,7 +210,7 @@ void Canvas::output_file(){
|
|||
|
||||
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);
|
||||
|
||||
|
@ -230,18 +228,18 @@ void Canvas::output_raw(){
|
|||
}
|
||||
|
||||
void Canvas::input_raw(const char * filename){
|
||||
ifstream infile(filename, ifstream::binary);
|
||||
std::ifstream infile(filename, std::ifstream::binary);
|
||||
|
||||
if ( ! infile ) {
|
||||
cout << "poep" << endl;
|
||||
std::cout << "poep" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
infile.seekg (0, ios::end);
|
||||
infile.seekg (0, std::ios::end);
|
||||
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);
|
||||
}
|
||||
|
|
36
Canvas.hpp
36
Canvas.hpp
|
@ -1,28 +1,28 @@
|
|||
#ifndef CANVAS_HPP
|
||||
#define CANVAS_HPP
|
||||
|
||||
#ifndef CANVAS_HPP
|
||||
#define CANVAS_HPP
|
||||
|
||||
|
||||
//#include "Vector.hpp"
|
||||
#include "Attractor.hpp"
|
||||
#include "Projector.hpp"
|
||||
|
||||
// TODO : Canvas class abstraheren (zodat er makkelijk verschillende soorten canvae gemaakt kunnen worden)
|
||||
#include "Projector.hpp"
|
||||
|
||||
// TODO : Canvas class abstraheren (zodat er makkelijk verschillende soorten canvae gemaakt kunnen worden)
|
||||
|
||||
class Canvas{
|
||||
friend class Projector;
|
||||
|
||||
|
||||
unsigned int dim;
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
unsigned int num_colors;
|
||||
|
||||
unsigned int num_colors;
|
||||
|
||||
unsigned int * size;
|
||||
|
||||
unsigned int * int_array;
|
||||
|
||||
public:
|
||||
|
||||
double v;
|
||||
public:
|
||||
|
||||
double v;
|
||||
|
||||
Canvas(unsigned int width, unsigned int height, unsigned int num_colors = 1);
|
||||
|
||||
|
@ -38,13 +38,13 @@ class Canvas{
|
|||
//void output(Vector& point);
|
||||
|
||||
void output_file(const char * filename);
|
||||
void output_file();
|
||||
void output_raw(const char * filename);
|
||||
void output_raw();
|
||||
void output_file();
|
||||
void output_raw(const char * filename);
|
||||
void output_raw();
|
||||
void input_raw(const char * filename);
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // CANVAS_HPP
|
||||
|
||||
|
||||
#endif // CANVAS_HPP
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#include <iostream>
|
||||
#include <cmath>
|
||||
#include <vector>
|
||||
#include <cassert>
|
||||
using namespace std;
|
||||
|
||||
#include "Projector.hpp"
|
||||
#include "Canvas.hpp"
|
||||
|
@ -66,7 +64,7 @@ void Projector::finish_range() {
|
|||
if ( factor * dist > (double)canvas->size[i] ) {
|
||||
factor = (double)canvas->size[i] / dist;
|
||||
//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(){
|
||||
cout << "Projector properties: " << endl;
|
||||
cout << " factor: " << factor << endl;
|
||||
std::cout << "Projector properties: " << std::endl;
|
||||
std::cout << " factor: " << factor << std::endl;
|
||||
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
|
||||
#define PROJECTOR_HPP
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "Canvas.hpp"
|
||||
#ifndef PROJECTOR_HPP
|
||||
#define PROJECTOR_HPP
|
||||
|
||||
class Canvas;
|
||||
|
||||
|
@ -28,18 +24,18 @@ class Projector{
|
|||
void finish_range();
|
||||
|
||||
|
||||
// TODO : Matrix gebruiken voor lineaire afbeelding
|
||||
// TODO : Over kleuren nadenken
|
||||
/*
|
||||
Kleurmodi:
|
||||
-genormalizeerde coordinaten als kleurintensiteit (gebruikt fp canvas)
|
||||
-kleurbanden, dus met een periodieke functie (gebruikt int canvas)
|
||||
// TODO : Matrix gebruiken voor lineaire afbeelding
|
||||
// TODO : Over kleuren nadenken
|
||||
/*
|
||||
Kleurmodi:
|
||||
-genormalizeerde coordinaten als kleurintensiteit (gebruikt fp canvas)
|
||||
-kleurbanden, dus met een periodieke functie (gebruikt int canvas)
|
||||
*/
|
||||
void project(const double * point);
|
||||
void plot(const double * point);
|
||||
|
||||
void output();
|
||||
};
|
||||
|
||||
#endif // PROJECTOR_HPP
|
||||
|
||||
void output();
|
||||
};
|
||||
|
||||
#endif // PROJECTOR_HPP
|
||||
|
||||
|
|
|
@ -12,6 +12,10 @@
|
|||
|
||||
#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 {
|
||||
private:
|
||||
|
||||
|
|
|
@ -12,6 +12,10 @@
|
|||
|
||||
#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 {
|
||||
|
||||
protected:
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
//
|
||||
|
||||
#include "Logistic.hpp"
|
||||
#include <algorithm>
|
||||
|
||||
Logistic::Logistic():
|
||||
KernelBasicParameter(3),
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "Lorenz3D.hpp"
|
||||
#include <algorithm>
|
||||
|
||||
Lorenz3D::Lorenz3D():
|
||||
KernelBasicParameter(4),
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
//
|
||||
|
||||
#include "Polynomial.hpp"
|
||||
#include <algorithm>
|
||||
//#include <iostream>
|
||||
|
||||
Polynomial::Polynomial():
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
//
|
||||
|
||||
#include "PolynomialA3D.hpp"
|
||||
#include <algorithm>
|
||||
|
||||
PolynomialA3D::PolynomialA3D():
|
||||
KernelBasicParameter(3),
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "Unravel3D.hpp"
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
|
||||
Unravel3D::Unravel3D():
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#define MYMATH_HPP
|
||||
|
||||
#include <cmath>
|
||||
using namespace std;
|
||||
|
||||
bool even(double x) {
|
||||
return (((int)floor(x)) % 2 == 0);
|
||||
|
|
Reference in a new issue