summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ThrownTogetherRenderer.cc6
-rw-r--r--src/csgterm.cc42
-rw-r--r--src/dxfdata.cc6
-rw-r--r--src/dxfdim.cc19
-rw-r--r--src/dxfdim.h9
-rw-r--r--src/dxftess-cgal.cc15
-rw-r--r--src/handle_dep.cc12
-rw-r--r--src/import.cc4
-rw-r--r--src/linalg.h4
-rw-r--r--src/surface.cc4
10 files changed, 84 insertions, 37 deletions
diff --git a/src/ThrownTogetherRenderer.cc b/src/ThrownTogetherRenderer.cc
index 146d2e1..b22c6a5 100644
--- a/src/ThrownTogetherRenderer.cc
+++ b/src/ThrownTogetherRenderer.cc
@@ -30,7 +30,8 @@
#include "system-gl.h"
-#include <boost/unordered_map.hpp>
+//#include <boost/unordered_map.hpp>
+#include <map>
ThrownTogetherRenderer::ThrownTogetherRenderer(CSGChain *root_chain,
CSGChain *highlights_chain,
@@ -62,7 +63,8 @@ void ThrownTogetherRenderer::renderCSGChain(CSGChain *chain, bool highlight,
bool fberror) const
{
glDepthFunc(GL_LEQUAL);
- boost::unordered_map<std::pair<PolySet*,Transform3d*>,int> polySetVisitMark;
+ //boost::unordered_map<std::pair<PolySet*,Transform3d*>,int> polySetVisitMark;
+ std::map<std::pair<PolySet*,Transform3d*>,int> polySetVisitMark;
for (size_t i = 0; i < chain->polysets.size(); i++) {
if (polySetVisitMark[std::make_pair(chain->polysets[i].get(), &chain->matrices[i])]++ > 0)
continue;
diff --git a/src/csgterm.cc b/src/csgterm.cc
index 0e68320..aed97b2 100644
--- a/src/csgterm.cc
+++ b/src/csgterm.cc
@@ -66,16 +66,29 @@ shared_ptr<CSGTerm> CSGTerm::createCSGTerm(type_e type, shared_ptr<CSGTerm> left
// http://www.cc.gatech.edu/~turk/my_papers/pxpl_csg.pdf
const BoundingBox &leftbox = left->getBoundingBox();
const BoundingBox &rightbox = right->getBoundingBox();
+ Vector3d newmin, newmax;
if (type == TYPE_INTERSECTION) {
- BoundingBox newbox(leftbox.min().cwise().max(rightbox.min()),
- leftbox.max().cwise().min(rightbox.max()));
+#if EIGEN_WORLD_VERSION == 2
+ newmin = leftbox.min().cwise().max( rightbox.min() );
+ newmax = leftbox.max().cwise().min( rightbox.max() );
+#else
+ newmin = leftbox.min().array().cwiseMax( rightbox.min().array() );
+ newmax = leftbox.max().array().cwiseMin( rightbox.max().array() );
+#endif
+ BoundingBox newbox( newmin, newmax );
if (newbox.isNull()) {
return shared_ptr<CSGTerm>(); // Prune entire product
}
}
else if (type == TYPE_DIFFERENCE) {
- BoundingBox newbox(leftbox.min().cwise().max(rightbox.min()),
- leftbox.max().cwise().min(rightbox.max()));
+#if EIGEN_WORLD_VERSION == 2
+ newmin = leftbox.min().cwise().max( rightbox.min() );
+ newmax = leftbox.max().cwise().min( rightbox.max() );
+#else
+ newmin = leftbox.min().array().cwiseMax( rightbox.min().array() );
+ newmax = leftbox.max().array().cwiseMin( rightbox.max().array() );
+#endif
+ BoundingBox newbox( newmin, newmax );
if (newbox.isNull()) {
return left; // Prune the negative component
}
@@ -119,14 +132,27 @@ void CSGTerm::initBoundingBox()
else {
const BoundingBox &leftbox = this->left->getBoundingBox();
const BoundingBox &rightbox = this->right->getBoundingBox();
+ Vector3d newmin, newmax;
switch (this->type) {
case TYPE_UNION:
- this->bbox = this->m * BoundingBox(leftbox.min().cwise().min(rightbox.min()),
- leftbox.max().cwise().max(rightbox.max()));
+#if EIGEN_WORLD_VERSION == 2
+ newmin = leftbox.min().cwise().min( rightbox.min() );
+ newmax = leftbox.max().cwise().max( rightbox.max() );
+#else
+ newmin = leftbox.min().array().cwiseMin( rightbox.min().array() );
+ newmax = leftbox.max().array().cwiseMax( rightbox.max().array() );
+#endif
+ this->bbox = this->m * BoundingBox( newmin, newmax );
break;
case TYPE_INTERSECTION:
- this->bbox = this->m * BoundingBox(leftbox.min().cwise().max(rightbox.min()),
- leftbox.max().cwise().min(rightbox.max()));
+#if EIGEN_WORLD_VERSION == 2
+ newmin = leftbox.min().cwise().max( rightbox.min() );
+ newmax = leftbox.max().cwise().min( rightbox.max() );
+#else
+ newmin = leftbox.min().array().cwiseMax( rightbox.min().array() );
+ newmax = leftbox.max().array().cwiseMin( rightbox.max().array() );
+#endif
+ this->bbox = this->m * BoundingBox( newmin, newmax );
break;
case TYPE_DIFFERENCE:
this->bbox = this->m * leftbox;
diff --git a/src/dxfdata.cc b/src/dxfdata.cc
index 4258a4c..080e780 100644
--- a/src/dxfdata.cc
+++ b/src/dxfdata.cc
@@ -85,7 +85,8 @@ DxfData::DxfData(double fn, double fs, double fa,
Grid2d< std::vector<int> > grid(GRID_COARSE);
std::vector<Line> lines; // Global lines
- boost::unordered_map< std::string, std::vector<Line> > blockdata; // Lines in blocks
+ //boost::unordered_map< std::string, std::vector<Line> > blockdata; // Lines in blocks
+ std::map< std::string, std::vector<Line> > blockdata; // Lines in blocks
bool in_entities_section = false;
bool in_blocks_section = false;
@@ -123,7 +124,8 @@ DxfData::DxfData(double fn, double fs, double fa,
for (int j = 0; j < 2; j++)
coords[i][j] = 0;
- typedef boost::unordered_map<std::string, int> EntityList;
+ //typedef boost::unordered_map<std::string, int> EntityList;
+ typedef std::map<std::string, int> EntityList;
EntityList unsupported_entities_list;
//
diff --git a/src/dxfdim.cc b/src/dxfdim.cc
index 8f68ac6..6f1b0ab 100644
--- a/src/dxfdim.cc
+++ b/src/dxfdim.cc
@@ -36,10 +36,12 @@
#include <sstream>
#include <boost/filesystem.hpp>
-using namespace boost::filesystem;
-
-boost::unordered_map<std::string,Value> dxf_dim_cache;
-boost::unordered_map<std::string,Value> dxf_cross_cache;
+//boost::unordered_map<std::string,Value> dxf_dim_cache;
+//boost::unordered_map<std::string,Value> dxf_cross_cache;
+#include <map>
+std::map<std::string,Value> dxf_dim_cache;
+std::map<std::string,Value> dxf_cross_cache;
+namespace fs = boost::filesystem;
Value builtin_dxf_dim(const Context *ctx, const std::vector<std::string> &argnames, const std::vector<Value> &args)
{
@@ -65,8 +67,8 @@ Value builtin_dxf_dim(const Context *ctx, const std::vector<std::string> &argnam
std::stringstream keystream;
keystream << filename << "|" << layername << "|" << name << "|" << xorigin
- << "|" << yorigin <<"|" << scale << "|" << last_write_time(filename)
- << "|" << file_size(filename);
+ << "|" << yorigin <<"|" << scale << "|" << fs::last_write_time(filename)
+ << "|" << fs::file_size(filename);
std::string key = keystream.str();
if (dxf_dim_cache.find(key) != dxf_dim_cache.end())
return dxf_dim_cache.find(key)->second;
@@ -147,8 +149,8 @@ Value builtin_dxf_cross(const Context *ctx, const std::vector<std::string> &argn
std::stringstream keystream;
keystream << filename << "|" << layername << "|" << xorigin << "|" << yorigin
- << "|" << scale << "|" << last_write_time(filename)
- << "|" << file_size(filename);
+ << "|" << scale << "|" << fs::last_write_time(filename)
+ << "|" << fs::file_size(filename);
std::string key = keystream.str();
if (dxf_cross_cache.find(key) != dxf_cross_cache.end())
@@ -186,7 +188,6 @@ Value builtin_dxf_cross(const Context *ctx, const std::vector<std::string> &argn
}
PRINTB("WARNING: Can't find cross in '%s', layer '%s'!", filename % layername);
-
return Value();
}
diff --git a/src/dxfdim.h b/src/dxfdim.h
index bd42109..5dc0ae0 100644
--- a/src/dxfdim.h
+++ b/src/dxfdim.h
@@ -1,10 +1,13 @@
#ifndef DXFDIM_H_
#define DXFDIM_H_
-#include <boost/unordered_map.hpp>
+//#include <boost/unordered_map.hpp>
+#include <map>
#include "value.h"
-extern boost::unordered_map<std::string,Value> dxf_dim_cache;
-extern boost::unordered_map<std::string,Value> dxf_cross_cache;
+//extern boost::unordered_map<std::string,Value> dxf_dim_cache;
+//extern boost::unordered_map<std::string,Value> dxf_cross_cache;
+extern std::map<std::string,Value> dxf_dim_cache;
+extern std::map<std::string,Value> dxf_cross_cache;
#endif
diff --git a/src/dxftess-cgal.cc b/src/dxftess-cgal.cc
index f221e3a..d19ef61 100644
--- a/src/dxftess-cgal.cc
+++ b/src/dxftess-cgal.cc
@@ -30,7 +30,8 @@ typedef CGAL::Constrained_Delaunay_triangulation_2<K, Tds> CDT;
typedef CDT::Vertex_handle Vertex_handle;
typedef CDT::Point CDTPoint;
-#include <boost/unordered_map.hpp>
+//#include <boost/unordered_map.hpp>
+#include <map>
template <class T> class DummyCriteria {
public:
@@ -71,8 +72,10 @@ struct point_info_t
typedef std::pair<point_info_t*,point_info_t*> edge_t;
void mark_inner_outer(std::vector<struct triangle> &tri, Grid2d<point_info_t> &point_info,
- boost::unordered_map<edge_t,int> &edge_to_triangle,
- boost::unordered_map<edge_t,int> &edge_to_path, int idx, bool inner)
+ std::map<edge_t,int> &edge_to_triangle,
+ std::map<edge_t,int> &edge_to_path, int idx, bool inner)
+// boost::unordered_map<edge_t,int> &edge_to_triangle,
+// boost::unordered_map<edge_t,int> &edge_to_path, int idx, bool inner)
{
if (tri[idx].is_marked)
return;
@@ -107,8 +110,10 @@ void dxf_tesselate(PolySet *ps, DxfData &dxf, double rot, bool up, bool /* do_tr
std::vector<struct triangle> tri;
Grid2d<point_info_t> point_info(GRID_FINE);
- boost::unordered_map<edge_t,int> edge_to_triangle;
- boost::unordered_map<edge_t,int> edge_to_path;
+// boost::unordered_map<edge_t,int> edge_to_triangle;
+// boost::unordered_map<edge_t,int> edge_to_path;
+ std::map<edge_t,int> edge_to_triangle;
+ std::map<edge_t,int> edge_to_path;
CGAL::Failure_behaviour old_behaviour = CGAL::set_error_behaviour(CGAL::THROW_EXCEPTION);
try {
diff --git a/src/handle_dep.cc b/src/handle_dep.cc
index cbf7157..0bebb70 100644
--- a/src/handle_dep.cc
+++ b/src/handle_dep.cc
@@ -6,22 +6,24 @@
#include <boost/foreach.hpp>
#include <boost/regex.hpp>
#include <boost/filesystem.hpp>
-using namespace boost::filesystem;
+namespace fs = boost::filesystem;
#include "boosty.h"
+#include <set>
-boost::unordered_set<std::string> dependencies;
+//boost::unordered_set<std::string> dependencies;
+std::set<std::string> dependencies;
const char *make_command = NULL;
void handle_dep(const std::string &filename)
{
- path filepath(filename);
+ fs::path filepath(filename);
if ( boosty::is_absolute( filepath )) {
dependencies.insert(filename);
}
else {
- dependencies.insert((current_path() / filepath).string());
+ dependencies.insert((fs::current_path() / filepath).string());
}
- if (!exists(filepath) && make_command) {
+ if (!fs::exists(filepath) && make_command) {
std::stringstream buf;
buf << make_command << " '" << boost::regex_replace(filename, boost::regex("'"), "'\\''") << "'";
system(buf.str().c_str()); // FIXME: Handle error
diff --git a/src/import.cc b/src/import.cc
index dc40c8d..1073459 100644
--- a/src/import.cc
+++ b/src/import.cc
@@ -47,7 +47,7 @@
#include <boost/regex.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/filesystem.hpp>
-using namespace boost::filesystem;
+namespace fs = boost::filesystem;
#include <boost/assign/std/vector.hpp>
using namespace boost::assign; // bring 'operator+=()' into scope
#include "boosty.h"
@@ -80,7 +80,7 @@ AbstractNode *ImportModule::evaluate(const Context *ctx, const ModuleInstantiati
std::string filename = c.getAbsolutePath(v.isUndefined() ? "" : v.toString());
import_type_e actualtype = this->type;
if (actualtype == TYPE_UNKNOWN) {
- std::string extraw = boosty::extension_str( path(filename) );
+ std::string extraw = boosty::extension_str( fs::path(filename) );
std::string ext = boost::algorithm::to_lower_copy( extraw );
if (ext == ".stl") actualtype = TYPE_STL;
else if (ext == ".off") actualtype = TYPE_OFF;
diff --git a/src/linalg.h b/src/linalg.h
index 65243dc..7f12a2e 100644
--- a/src/linalg.h
+++ b/src/linalg.h
@@ -12,7 +12,11 @@ typedef Eigen::AlignedBox<double, 3> BoundingBox;
using Eigen::Matrix3f;
using Eigen::Matrix3d;
using Eigen::Matrix4d;
+#if EIGEN_WORLD_VERSION >= 3
+#define Transform3d Eigen::Affine3d
+#else
using Eigen::Transform3d;
+#endif
BoundingBox operator*(const Transform3d &m, const BoundingBox &box);
diff --git a/src/surface.cc b/src/surface.cc
index 2fa3717..eb6561e 100644
--- a/src/surface.cc
+++ b/src/surface.cc
@@ -42,6 +42,7 @@
#include <boost/algorithm/string.hpp>
#include <boost/assign/std/vector.hpp>
using namespace boost::assign; // bring 'operator+=()' into scope
+#include <map>
#include <boost/filesystem.hpp>
namespace fs = boost::filesystem;
@@ -110,7 +111,8 @@ PolySet *SurfaceNode::evaluate_polyset(class PolySetEvaluator *) const
PolySet *p = new PolySet();
int lines = 0, columns = 0;
- boost::unordered_map<std::pair<int,int>,double> data;
+ //boost::unordered_map<std::pair<int,int>,double> data;
+ std::map<std::pair<int,int>,double> data;
double min_val = 0;
typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
contact: Jan Huwald // Impressum