mac osx is not supported (due to libpng++), removed a lot of warnings
This commit is contained in:
parent
b0efc2f514
commit
4859798b11
11 changed files with 99 additions and 20 deletions
|
@ -7,8 +7,10 @@
|
||||||
#include "AttractorKernel.hpp"
|
#include "AttractorKernel.hpp"
|
||||||
#include "Projector.hpp"
|
#include "Projector.hpp"
|
||||||
|
|
||||||
Attractor::Attractor() :
|
Attractor::Attractor()
|
||||||
kernel(0), projector(0) {
|
: projector(0)
|
||||||
|
, kernel(0)
|
||||||
|
{
|
||||||
stfu::node kernel_node;
|
stfu::node kernel_node;
|
||||||
switch(rand()%2+1){
|
switch(rand()%2+1){
|
||||||
case 0:
|
case 0:
|
||||||
|
|
|
@ -14,7 +14,10 @@ public:
|
||||||
// should be private really
|
// should be private really
|
||||||
Projector* projector;
|
Projector* projector;
|
||||||
|
|
||||||
Attractor(const std::string& filename) {
|
Attractor(const std::string& filename)
|
||||||
|
: projector(0)
|
||||||
|
, kernel(0)
|
||||||
|
{
|
||||||
LogInfo("Reading file '%s'...\n", filename.c_str());
|
LogInfo("Reading file '%s'...\n", filename.c_str());
|
||||||
|
|
||||||
stfu::node system;
|
stfu::node system;
|
||||||
|
@ -75,6 +78,9 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AttractorKernel* kernel;
|
AttractorKernel* kernel;
|
||||||
|
|
||||||
|
Attractor(Attractor const &);
|
||||||
|
Attractor& operator=(Attractor const &);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ATTRACTOR_HPP
|
#endif // ATTRACTOR_HPP
|
||||||
|
|
|
@ -140,6 +140,9 @@ private:
|
||||||
delete[] parameters;
|
delete[] parameters;
|
||||||
parameters = NULL;
|
parameters = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AttractorKernel(AttractorKernel const &);
|
||||||
|
AttractorKernel & operator=(AttractorKernel const &);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
01C5701513B63AF0009D151B /* Attractor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 01C5701113B63AF0009D151B /* Attractor.cpp */; };
|
01C5701513B63AF0009D151B /* Attractor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 01C5701113B63AF0009D151B /* Attractor.cpp */; };
|
||||||
01C5702913B63B56009D151B /* Raw.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 01C5702813B63B56009D151B /* Raw.cpp */; };
|
01C5702913B63B56009D151B /* Raw.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 01C5702813B63B56009D151B /* Raw.cpp */; };
|
||||||
01C5703213B63B78009D151B /* stf.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 01C5703113B63B78009D151B /* stf.cpp */; };
|
01C5703213B63B78009D151B /* stf.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 01C5703113B63B78009D151B /* stf.cpp */; };
|
||||||
01C5703813B63B90009D151B /* pngwriter.cc in Sources */ = {isa = PBXBuildFile; fileRef = 01C5703713B63B90009D151B /* pngwriter.cc */; };
|
|
||||||
01C5704313B63BBE009D151B /* Projection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 01C5704013B63BBE009D151B /* Projection.cpp */; };
|
01C5704313B63BBE009D151B /* Projection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 01C5704013B63BBE009D151B /* Projection.cpp */; };
|
||||||
01C5704413B63BBE009D151B /* Normalizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 01C5704213B63BBE009D151B /* Normalizer.cpp */; };
|
01C5704413B63BBE009D151B /* Normalizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 01C5704213B63BBE009D151B /* Normalizer.cpp */; };
|
||||||
01C5707E13B63CF9009D151B /* libpng.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 01C5707D13B63CF9009D151B /* libpng.a */; };
|
01C5707E13B63CF9009D151B /* libpng.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 01C5707D13B63CF9009D151B /* libpng.a */; };
|
||||||
|
@ -52,7 +51,6 @@
|
||||||
01C5702813B63B56009D151B /* Raw.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Raw.cpp; path = canvae/Raw.cpp; sourceTree = "<group>"; };
|
01C5702813B63B56009D151B /* Raw.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Raw.cpp; path = canvae/Raw.cpp; sourceTree = "<group>"; };
|
||||||
01C5703013B63B78009D151B /* stf.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = stf.hpp; path = stfu/stf.hpp; sourceTree = "<group>"; };
|
01C5703013B63B78009D151B /* stf.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = stf.hpp; path = stfu/stf.hpp; sourceTree = "<group>"; };
|
||||||
01C5703113B63B78009D151B /* stf.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = stf.cpp; path = stfu/stf.cpp; sourceTree = "<group>"; };
|
01C5703113B63B78009D151B /* stf.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = stf.cpp; path = stfu/stf.cpp; sourceTree = "<group>"; };
|
||||||
01C5703713B63B90009D151B /* pngwriter.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = pngwriter.cc; path = pngwriter/pngwriter.cc; sourceTree = "<group>"; };
|
|
||||||
01C5703913B63BA3009D151B /* Unravel3D.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Unravel3D.hpp; path = kernels/Unravel3D.hpp; sourceTree = "<group>"; };
|
01C5703913B63BA3009D151B /* Unravel3D.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Unravel3D.hpp; path = kernels/Unravel3D.hpp; sourceTree = "<group>"; };
|
||||||
01C5703A13B63BA3009D151B /* PolynomialA3D.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = PolynomialA3D.hpp; path = kernels/PolynomialA3D.hpp; sourceTree = "<group>"; };
|
01C5703A13B63BA3009D151B /* PolynomialA3D.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = PolynomialA3D.hpp; path = kernels/PolynomialA3D.hpp; sourceTree = "<group>"; };
|
||||||
01C5703B13B63BA3009D151B /* Polynomial.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Polynomial.hpp; path = kernels/Polynomial.hpp; sourceTree = "<group>"; };
|
01C5703B13B63BA3009D151B /* Polynomial.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Polynomial.hpp; path = kernels/Polynomial.hpp; sourceTree = "<group>"; };
|
||||||
|
@ -65,6 +63,7 @@
|
||||||
01C5704213B63BBE009D151B /* Normalizer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Normalizer.cpp; path = projectors/Normalizer.cpp; sourceTree = "<group>"; };
|
01C5704213B63BBE009D151B /* Normalizer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Normalizer.cpp; path = projectors/Normalizer.cpp; sourceTree = "<group>"; };
|
||||||
01C5707D13B63CF9009D151B /* libpng.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libpng.a; path = /usr/local/lib/libpng.a; sourceTree = "<absolute>"; };
|
01C5707D13B63CF9009D151B /* libpng.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libpng.a; path = /usr/local/lib/libpng.a; sourceTree = "<absolute>"; };
|
||||||
08FB7796FE84155DC02AAC07 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; };
|
08FB7796FE84155DC02AAC07 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; };
|
||||||
|
420486591455B11C0025CC53 /* libpng.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = libpng.hpp; path = canvae/libpng.hpp; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
|
@ -106,6 +105,7 @@
|
||||||
08FB7794FE84155DC02AAC07 /* AwesomeAttract0r */ = {
|
08FB7794FE84155DC02AAC07 /* AwesomeAttract0r */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
420486591455B11C0025CC53 /* libpng.hpp */,
|
||||||
01C5703F13B63BBE009D151B /* Projection.hpp */,
|
01C5703F13B63BBE009D151B /* Projection.hpp */,
|
||||||
01C5704013B63BBE009D151B /* Projection.cpp */,
|
01C5704013B63BBE009D151B /* Projection.cpp */,
|
||||||
01C5704113B63BBE009D151B /* Normalizer.hpp */,
|
01C5704113B63BBE009D151B /* Normalizer.hpp */,
|
||||||
|
@ -137,7 +137,6 @@
|
||||||
01C5700E13B63AF0009D151B /* AwesomeAttractorConfig.h */,
|
01C5700E13B63AF0009D151B /* AwesomeAttractorConfig.h */,
|
||||||
01C5701013B63AF0009D151B /* Attractor.hpp */,
|
01C5701013B63AF0009D151B /* Attractor.hpp */,
|
||||||
01C5701113B63AF0009D151B /* Attractor.cpp */,
|
01C5701113B63AF0009D151B /* Attractor.cpp */,
|
||||||
01C5703713B63B90009D151B /* pngwriter.cc */,
|
|
||||||
08FB7796FE84155DC02AAC07 /* main.cpp */,
|
08FB7796FE84155DC02AAC07 /* main.cpp */,
|
||||||
);
|
);
|
||||||
name = Source;
|
name = Source;
|
||||||
|
@ -215,7 +214,6 @@
|
||||||
01C5701513B63AF0009D151B /* Attractor.cpp in Sources */,
|
01C5701513B63AF0009D151B /* Attractor.cpp in Sources */,
|
||||||
01C5702913B63B56009D151B /* Raw.cpp in Sources */,
|
01C5702913B63B56009D151B /* Raw.cpp in Sources */,
|
||||||
01C5703213B63B78009D151B /* stf.cpp in Sources */,
|
01C5703213B63B78009D151B /* stf.cpp in Sources */,
|
||||||
01C5703813B63B90009D151B /* pngwriter.cc in Sources */,
|
|
||||||
01C5704313B63BBE009D151B /* Projection.cpp in Sources */,
|
01C5704313B63BBE009D151B /* Projection.cpp in Sources */,
|
||||||
01C5704413B63BBE009D151B /* Normalizer.cpp in Sources */,
|
01C5704413B63BBE009D151B /* Normalizer.cpp in Sources */,
|
||||||
);
|
);
|
||||||
|
|
|
@ -71,6 +71,9 @@ private:
|
||||||
delete[] projectedColor;
|
delete[] projectedColor;
|
||||||
projectedColor = NULL;
|
projectedColor = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Projector(Projector const &);
|
||||||
|
Projector & operator=(Projector const &);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PROJECTOR_HPP
|
#endif // PROJECTOR_HPP
|
||||||
|
|
|
@ -4,9 +4,18 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <array>
|
#include <cmath>
|
||||||
|
|
||||||
#include <png++/png.hpp>
|
#ifndef __APPLE__
|
||||||
|
#include <array>
|
||||||
|
#else
|
||||||
|
#include <tr1/array>
|
||||||
|
namespace std {
|
||||||
|
using tr1::array;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "libpng.hpp"
|
||||||
|
|
||||||
#include "../Canvas.hpp"
|
#include "../Canvas.hpp"
|
||||||
|
|
||||||
|
@ -22,8 +31,13 @@ public:
|
||||||
|
|
||||||
double v;
|
double v;
|
||||||
|
|
||||||
PNG(unsigned int width, unsigned int height, unsigned int num_colors = 1):
|
PNG(unsigned int width, unsigned int height, unsigned int num_colors = 1)
|
||||||
Canvas(2), width(width), height(height), num_colors(num_colors), v(0) {
|
: Canvas(2)
|
||||||
|
, width(width)
|
||||||
|
, height(height)
|
||||||
|
, num_colors(num_colors)
|
||||||
|
, int_array(0)
|
||||||
|
, v(2.0) {
|
||||||
|
|
||||||
//int_array = std::make_shared<vstd::vector<unsigned int>>(width*height*num_colors);
|
//int_array = std::make_shared<vstd::vector<unsigned int>>(width*height*num_colors);
|
||||||
int_array = new unsigned int[width*height*num_colors];
|
int_array = new unsigned int[width*height*num_colors];
|
||||||
|
@ -80,7 +94,7 @@ public:
|
||||||
|
|
||||||
|
|
||||||
const double average = cumulative / (double)(width*height);
|
const double average = cumulative / (double)(width*height);
|
||||||
power[i] = -2.5/log(average/(double)max_int[i]);
|
power[i] = -2.5/std::log(average/(double)max_int[i]);
|
||||||
if(power[i] < 0) {
|
if(power[i] < 0) {
|
||||||
power[i] = 1;
|
power[i] = 1;
|
||||||
LogInfo("negative power\n");
|
LogInfo("negative power\n");
|
||||||
|
@ -92,7 +106,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const double vibrancy = 2.0;
|
const double vibrancy = v;
|
||||||
double averagePower = 0;
|
double averagePower = 0;
|
||||||
for(unsigned int i = 0; i < num_colors; i++) {
|
for(unsigned int i = 0; i < num_colors; i++) {
|
||||||
averagePower += power[i];
|
averagePower += power[i];
|
||||||
|
@ -125,9 +139,9 @@ public:
|
||||||
double b = 0.0;
|
double b = 0.0;
|
||||||
for(unsigned int c = 0; c < num_colors; c++) {
|
for(unsigned int c = 0; c < num_colors; c++) {
|
||||||
const double norm_value = (double)int_array[x + y*width + c*width*height]/max_int[c];
|
const double norm_value = (double)int_array[x + y*width + c*width*height]/max_int[c];
|
||||||
r += (pow(norm_value, power[c]*power_matrix[c+0]))*output_matrix[c+0];
|
r += (std::pow(norm_value, power[c]*power_matrix[c+0]))*output_matrix[c+0];
|
||||||
g += (pow(norm_value, power[c]*power_matrix[c+2]))*output_matrix[c+2];
|
g += (std::pow(norm_value, power[c]*power_matrix[c+2]))*output_matrix[c+2];
|
||||||
b += (pow(norm_value, power[c]*power_matrix[c+4]))*output_matrix[c+4];
|
b += (std::pow(norm_value, power[c]*power_matrix[c+4]))*output_matrix[c+4];
|
||||||
}
|
}
|
||||||
// TODO: also clamp is below 0 ?
|
// TODO: also clamp is below 0 ?
|
||||||
r = std::min(1.0, r);
|
r = std::min(1.0, r);
|
||||||
|
@ -145,6 +159,10 @@ public:
|
||||||
|
|
||||||
LogMoreInfo("File written");
|
LogMoreInfo("File written");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
PNG(PNG const &);
|
||||||
|
PNG & operator=(PNG const &);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PNG_HPP
|
#endif // PNG_HPP
|
||||||
|
|
|
@ -10,8 +10,13 @@
|
||||||
#include "Raw.hpp"
|
#include "Raw.hpp"
|
||||||
|
|
||||||
|
|
||||||
Raw::Raw(const unsigned int dimension, const unsigned int* sizes_):
|
Raw::Raw(const unsigned int dimension, const unsigned int* sizes_)
|
||||||
Canvas(dimension) {
|
: Canvas(dimension)
|
||||||
|
, sizes(0)
|
||||||
|
, sizesMultiplied(0)
|
||||||
|
, pixelArray(0)
|
||||||
|
, arraySize(1)
|
||||||
|
{
|
||||||
|
|
||||||
sizes = new unsigned int[dimension];
|
sizes = new unsigned int[dimension];
|
||||||
assert(sizes != NULL);
|
assert(sizes != NULL);
|
||||||
|
@ -24,7 +29,6 @@ Raw::Raw(const unsigned int dimension, const unsigned int* sizes_):
|
||||||
sizesMultiplied[i] = sizesMultiplied[i-1]*sizes[i-1];
|
sizesMultiplied[i] = sizesMultiplied[i-1]*sizes[i-1];
|
||||||
}
|
}
|
||||||
|
|
||||||
arraySize = 1;
|
|
||||||
for(unsigned int i = 0; i < dimension; ++i) {
|
for(unsigned int i = 0; i < dimension; ++i) {
|
||||||
arraySize *= sizes[i];
|
arraySize *= sizes[i];
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,10 @@ public:
|
||||||
virtual void clear();
|
virtual void clear();
|
||||||
virtual void plot(const double* normalizedPosition);
|
virtual void plot(const double* normalizedPosition);
|
||||||
virtual void output_file(const char* filename) const;
|
virtual void output_file(const char* filename) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Raw(Raw const &);
|
||||||
|
Raw & operator=(Raw const &);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
35
canvae/libpng.hpp
Normal file
35
canvae/libpng.hpp
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
//
|
||||||
|
// libpng.hpp
|
||||||
|
// AwesomeAttract0r
|
||||||
|
//
|
||||||
|
// Created by Joshua Moerman on 10/24/11.
|
||||||
|
// Copyright 2011 Vadovas. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef AwesomeAttract0r_libpng_hpp
|
||||||
|
#define AwesomeAttract0r_libpng_hpp
|
||||||
|
|
||||||
|
#ifndef __APPLE__
|
||||||
|
#include <png++/png.hpp>
|
||||||
|
#else
|
||||||
|
#warning PNG++ is not yet supported
|
||||||
|
namespace png {
|
||||||
|
template <typename T>
|
||||||
|
struct image{
|
||||||
|
image(unsigned int, unsigned int){}
|
||||||
|
|
||||||
|
image& operator[](unsigned int){return *this;}
|
||||||
|
|
||||||
|
template <typename S>
|
||||||
|
image& operator=(S const &){return *this;}
|
||||||
|
|
||||||
|
void write(std::string const &){}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct rgb_pixel{
|
||||||
|
rgb_pixel(unsigned int, unsigned int, unsigned int){}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
#include "../Logger.hpp"
|
#include "../Logger.hpp"
|
||||||
#include "Normalizer.hpp"
|
#include "Normalizer.hpp"
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,10 @@ protected:
|
||||||
public:
|
public:
|
||||||
Normalizer(unsigned int dimension);
|
Normalizer(unsigned int dimension);
|
||||||
virtual ~Normalizer();
|
virtual ~Normalizer();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Normalizer(Normalizer const &);
|
||||||
|
Normalizer & operator=(Normalizer const &);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // NORMALIZER_HPP
|
#endif // NORMALIZER_HPP
|
||||||
|
|
Reference in a new issue