maintain order of polygons in evaluateCGALMesh to fix issue 177. add option to dump more info to csgchain

felipesanches-svg
don bright 2012-08-18 15:40:15 +02:00
parent d87dd48215
commit 42043dd97d
3 changed files with 11 additions and 6 deletions

View File

@ -34,8 +34,8 @@
#include <assert.h>
#include <boost/foreach.hpp>
#include <boost/unordered_map.hpp>
#include <boost/bind.hpp>
#include <map>
CGAL_Nef_polyhedron CGALEvaluator::evaluateCGALMesh(const AbstractNode &node)
{
@ -445,9 +445,9 @@ CGAL_Nef_polyhedron CGALEvaluator::evaluateCGALMesh(const PolySet &ps)
struct PolyReducer
{
Grid2d<int> grid;
boost::unordered_map<std::pair<int,int>, std::pair<int,int> > edge_to_poly;
boost::unordered_map<int, CGAL_Nef_polyhedron2::Point> points;
typedef boost::unordered_map<int, std::vector<int> > PolygonMap;
std::map<std::pair<int,int>, std::pair<int,int> > edge_to_poly;
std::map<int, CGAL_Nef_polyhedron2::Point> points;
typedef std::map<int, std::vector<int> > PolygonMap;
PolygonMap polygons;
int poly_n;

View File

@ -178,7 +178,7 @@ void CSGChain::import(shared_ptr<CSGTerm> term, CSGTerm::type_e type)
}
}
std::string CSGChain::dump()
std::string CSGChain::dump(bool full=false)
{
std::stringstream dump;
@ -193,6 +193,11 @@ std::string CSGChain::dump()
else if (types[i] == CSGTerm::TYPE_INTERSECTION)
dump << " *";
dump << labels[i];
if (full) {
dump << " polyset: \n" << polysets[i]->dump() << "\n";
dump << " matrix: \n" << matrices[i].matrix() << "\n";
dump << " color: \n" << colors[i] << "\n";
}
}
dump << "\n";
return dump.str();

View File

@ -59,7 +59,7 @@ public:
void add(const shared_ptr<PolySet> &polyset, const Transform3d &m, const Color4f &color, CSGTerm::type_e type, std::string label);
void import(shared_ptr<CSGTerm> term, CSGTerm::type_e type = CSGTerm::TYPE_UNION);
std::string dump();
std::string dump(bool full);
BoundingBox getBoundingBox() const;
};