Skip converting to/from CGAL when importing a single object.

This commit is contained in:
Torsten Paul 2016-09-20 00:55:48 +02:00
parent c2cb0572a9
commit cfdbfe13a6

View file

@ -202,16 +202,20 @@ PolySet *import_amf(const std::string filename) {
PolySet *p; PolySet *p;
#ifdef ENABLE_CGAL #ifdef ENABLE_CGAL
Geometry::Geometries children; if (polySets.size() == 1) {
for (std::vector<PolySet *>::iterator it = polySets.begin();it != polySets.end();it++) { p = polySets[0];
children.push_back(std::make_pair((const AbstractNode*)NULL, shared_ptr<const Geometry>(*it)));
}
CGAL_Nef_polyhedron *N = CGALUtils::applyOperator(children, OPENSCAD_UNION);
PolySet *result = new PolySet(3);
if (CGALUtils::createPolySetFromNefPolyhedron3(*N->p3, *result)) {
delete result;
} else { } else {
p = result; Geometry::Geometries children;
for (std::vector<PolySet *>::iterator it = polySets.begin();it != polySets.end();it++) {
children.push_back(std::make_pair((const AbstractNode*)NULL, shared_ptr<const Geometry>(*it)));
}
CGAL_Nef_polyhedron *N = CGALUtils::applyOperator(children, OPENSCAD_UNION);
PolySet *result = new PolySet(3);
if (CGALUtils::createPolySetFromNefPolyhedron3(*N->p3, *result)) {
delete result;
} else {
p = result;
}
} }
#else #else
p = new PolySet(3); p = new PolySet(3);