From aec1169c90f09b3e68fd013239a89bbbfd25f768 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Fri, 27 Dec 2013 18:23:00 -0500 Subject: [PATCH] minor cleanup --- src/GeometryEvaluator.cc | 41 +++------------------------------------- src/GeometryEvaluator.h | 1 - 2 files changed, 3 insertions(+), 39 deletions(-) diff --git a/src/GeometryEvaluator.cc b/src/GeometryEvaluator.cc index 4b09fba9..1dd80f5d 100644 --- a/src/GeometryEvaluator.cc +++ b/src/GeometryEvaluator.cc @@ -18,7 +18,7 @@ #include "clipper-utils.h" #include "polyset-utils.h" #include "PolySet.h" -#include "openscad.h" // get_fragments_from_r() +#include "calc.h" #include "printutils.h" #include "svg.h" #include "dxfdata.h" @@ -33,32 +33,6 @@ GeometryEvaluator::GeometryEvaluator(const class Tree &tree): { } -/*! - Factory method returning a Geometry from the given node. If the - node is already cached, the cached Geometry will be returned - otherwise a new Geometry will be created from the node. If cache is - true, the newly created Geometry will be cached. - - FIXME: This looks redundant - */ -shared_ptr GeometryEvaluator::getGeometry(const AbstractNode &node, bool cache) -{ - std::string cacheid = this->tree.getIdString(node); - - if (GeometryCache::instance()->contains(cacheid)) { -#ifdef DEBUG - // For cache debugging - PRINTB("GeometryCache hit: %s", cacheid.substr(0, 40)); -#endif - return GeometryCache::instance()->get(cacheid); - } - - shared_ptr geom(this->evaluateGeometry(node, true)); - - if (cache) GeometryCache::instance()->insert(cacheid, geom); - return geom; -} - bool GeometryEvaluator::isCached(const AbstractNode &node) const { return GeometryCache::instance()->contains(this->tree.getIdString(node)); @@ -756,7 +730,7 @@ static Geometry *rotatePolygon(const RotateExtrudeNode &node, const Polygon2d &p return NULL; } } - int fragments = get_fragments_from_r(max_x - min_x, node.fn, node.fs, node.fa); + int fragments = Calc::get_fragments_from_r(max_x - min_x, node.fn, node.fs, node.fa); std::vector rings[2]; rings[0].resize(o.vertices.size()); @@ -931,7 +905,7 @@ Response GeometryEvaluator::visit(State &state, const ProjectionNode &node) /*! input: List of 2D or 3D objects (not mixed) - output: PolySet (FIXME: implement Polygon2d) + output: any Geometry operation: o Perform cgal operation */ @@ -995,15 +969,6 @@ Response GeometryEvaluator::visit(State &state, const CgaladvNode &node) default: assert(false && "not implemented"); } - // MINKOWSKI - // 2D children -> Polygon2d, apply Clipper minkowski - // 3D children -> Nef, apply CGAL minkowski - // HULL - // 2D children -> Polygon2d (or really point clouds), apply 2D hull (CGAL) - // 3D children -> PolySet (or really point clouds), apply 2D hull (CGAL) - // RESIZE - // 2D children -> Polygon2d -> union -> apply resize - // 3D children -> PolySet -> union -> apply resize } else { geom = GeometryCache::instance()->get(this->tree.getIdString(node)); diff --git a/src/GeometryEvaluator.h b/src/GeometryEvaluator.h index 29e1a957..ace20391 100644 --- a/src/GeometryEvaluator.h +++ b/src/GeometryEvaluator.h @@ -17,7 +17,6 @@ public: GeometryEvaluator(const class Tree &tree); virtual ~GeometryEvaluator() {} - shared_ptr getGeometry(const AbstractNode &node, bool cache); shared_ptr evaluateGeometry(const AbstractNode &node, bool allownef); virtual Response visit(State &state, const AbstractNode &node);