// Begin License: // Copyright (C) 2006-2008 Tobias Sargeant (tobias.sargeant@gmail.com). // All rights reserved. // // This file is part of the Carve CSG Library (http://carve-csg.com/) // // This file may be used under the terms of the GNU General Public // License version 2.0 as published by the Free Software Foundation // and appearing in the file LICENSE.GPL2 included in the packaging of // this file. // // This file is provided "AS IS" with NO WARRANTY OF ANY KIND, // INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE. // End: #pragma once #include #include #include #include #include namespace carve { namespace geom { std::vector convexHull(const std::vector &points); template std::vector convexHull(const project_t &project, const polygon_container_t &points) { std::vector proj; proj.reserve(points.size()); for (typename polygon_container_t::const_iterator i = points.begin(); i != points.end(); ++i) { proj.push_back(project(*i)); } return convexHull(proj); } template std::vector convexHull(const project_t &project, iter_t beg, iter_t end, size_t size_hint = 0) { std::vector proj; if (size_hint) proj.reserve(size_hint); for (; beg != end; ++beg) { proj.push_back(project(*beg)); } return convexHull(proj); } } }