当前位置: 首页>>代码示例>>C++>>正文


C++ const_iterator::simplify方法代码示例

本文整理汇总了C++中expolygons::const_iterator::simplify方法的典型用法代码示例。如果您正苦于以下问题:C++ const_iterator::simplify方法的具体用法?C++ const_iterator::simplify怎么用?C++ const_iterator::simplify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在expolygons::const_iterator的用法示例。


在下文中一共展示了const_iterator::simplify方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

void
ExPolygonCollection::simplify(double tolerance)
{
    ExPolygons expp;
    for (ExPolygons::const_iterator it = this->expolygons.begin(); it != this->expolygons.end(); ++it) {
        it->simplify(tolerance, expp);
    }
    this->expolygons = expp;
}
开发者ID:bjmckenz,项目名称:Slic3r,代码行数:9,代码来源:ExPolygonCollection.cpp

示例2: initialized

MotionPlanner::MotionPlanner(const ExPolygons &islands)
    : initialized(false)
{
    ExPolygons expp;
    for (ExPolygons::const_iterator island = islands.begin(); island != islands.end(); ++island)
        island->simplify(SCALED_EPSILON, &expp);
    
    for (ExPolygons::const_iterator island = expp.begin(); island != expp.end(); ++island)
        this->islands.push_back(MotionPlannerEnv(*island));
}
开发者ID:Salandora,项目名称:Slic3r,代码行数:10,代码来源:MotionPlanner.cpp

示例3: bb

void
MotionPlanner::initialize()
{
    if (this->initialized) return;
    if (this->islands.empty()) return;  // prevent initialization of empty BoundingBox
    
    ExPolygons expp;
    for (ExPolygons::const_iterator island = this->islands.begin(); island != this->islands.end(); ++island) {
        island->simplify(SCALED_EPSILON, expp);
    }
    this->islands = expp;
    
    // loop through islands in order to create inner expolygons and collect their contours
    this->inner.reserve(this->islands.size());
    Polygons outer_holes;
    for (ExPolygons::const_iterator island = this->islands.begin(); island != this->islands.end(); ++island) {
        this->inner.push_back(ExPolygonCollection());
        offset(*island, &this->inner.back().expolygons, -MP_INNER_MARGIN);
        
        outer_holes.push_back(island->contour);
    }
    
    // grow island contours in order to prepare holes of the outer environment
    // This is actually wrong because it might merge contours that are close,
    // thus confusing the island check in shortest_path() below
    //offset(outer_holes, &outer_holes, +MP_OUTER_MARGIN);
    
    // generate outer contour as bounding box of everything
    Points points;
    for (Polygons::const_iterator contour = outer_holes.begin(); contour != outer_holes.end(); ++contour)
        points.insert(points.end(), contour->points.begin(), contour->points.end());
    BoundingBox bb(points);
    
    // grow outer contour
    Polygons contour;
    offset(bb.polygon(), &contour, +MP_OUTER_MARGIN);
    assert(contour.size() == 1);
    
    // make expolygon for outer environment
    ExPolygons outer;
    diff(contour, outer_holes, &outer);
    assert(outer.size() == 1);
    this->outer = outer.front();
    
    this->graphs.resize(this->islands.size() + 1, NULL);
    this->initialized = true;
}
开发者ID:PetteriAimonen,项目名称:Slic3r,代码行数:47,代码来源:MotionPlanner.cpp


注:本文中的expolygons::const_iterator::simplify方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。