#ifndef LIBNEST2D_H #define LIBNEST2D_H // The type of backend should be set conditionally by the cmake configuriation // for now we set it statically to clipper backend #ifdef LIBNEST2D_BACKEND_CLIPPER #include #endif #ifdef LIBNEST2D_OPTIMIZER_NLOPT // We include the stock optimizers for local and global optimization #include // Local subplex for NfpPlacer #include // Genetic for min. bounding box #endif #include #include #include #include #include #include namespace libnest2d { using Point = PointImpl; using Coord = TCoord; using Box = _Box; using Segment = _Segment; using Circle = _Circle; using Item = _Item; using Rectangle = _Rectangle; using PackGroup = _PackGroup; using FillerSelection = selections::_FillerSelection; using FirstFitSelection = selections::_FirstFitSelection; using DJDHeuristic = selections::_DJDHeuristic; template // Generic placer for arbitrary bin types using _NfpPlacer = placers::_NofitPolyPlacer; // NfpPlacer is with Box bin using NfpPlacer = _NfpPlacer; // This supports only box shaped bins using BottomLeftPlacer = placers::_BottomLeftPlacer; #ifdef LIBNEST2D_STATIC extern template class Nester; extern template class Nester; extern template PackGroup Nester::execute( std::vector::iterator, std::vector::iterator); extern template PackGroup Nester::execute( std::vector::iterator, std::vector::iterator); #endif template::iterator> void nest(Iterator from, Iterator to, const typename Placer::BinType& bin, Coord dist = 0, const typename Placer::Config& pconf = {}, const typename Selector::Config& sconf = {}) { _Nester nester(bin, dist, pconf, sconf); nester.execute(from, to); } template::iterator> void nest(Iterator from, Iterator to, const typename Placer::BinType& bin, ProgressFunction prg, StopCondition scond = []() { return false; }, Coord dist = 0, const typename Placer::Config& pconf = {}, const typename Selector::Config& sconf = {}) { _Nester nester(bin, dist, pconf, sconf); if(prg) nester.progressIndicator(prg); if(scond) nester.stopCondition(scond); nester.execute(from, to); } #ifdef LIBNEST2D_STATIC extern template class Nester; extern template class Nester; extern template void nest(std::vector::iterator from, std::vector::iterator to, const Box& bin, Coord dist = 0, const NfpPlacer::Config& pconf, const FirstFitSelection::Config& sconf); extern template void nest(std::vector::iterator from, std::vector::iterator to, const Box& bin, ProgressFunction prg, StopCondition scond, Coord dist = 0, const NfpPlacer::Config& pconf, const FirstFitSelection::Config& sconf); #endif template> void nest(Container&& cont, const typename Placer::BinType& bin, Coord dist = 0, const typename Placer::Config& pconf = {}, const typename Selector::Config& sconf = {}) { nest(cont.begin(), cont.end(), bin, dist, pconf, sconf); } template> void nest(Container&& cont, const typename Placer::BinType& bin, ProgressFunction prg, StopCondition scond = []() { return false; }, Coord dist = 0, const typename Placer::Config& pconf = {}, const typename Selector::Config& sconf = {}) { nest(cont.begin(), cont.end(), bin, prg, scond, dist, pconf, sconf); } } #endif // LIBNEST2D_H