void WallOverlapComputation::convertPolygonToList(PolygonRef poly, ListPolygon& result) { for (Point& p : poly) { result.push_back(p); } }
void test_update_operations(const ListPolygon& p, const vector<Point>& pvec) { // test update functions ListPolygon q = p; VectorPolygon pgn(p.vertices_begin(), p.vertices_end()); q.reverse_orientation(); cout << "p after reversing orientation: " << q << endl; assert(p==p); assert(!(p==q)); typedef ListPolygon::Vertex_iterator VI; typedef ListPolygon::Vertex_circulator VC; q=p; VI middle = q.vertices_begin(); ++middle; q.set(middle, *middle); // test update operations q.push_back(Point(2,3)); q.push_back(Point(middle->x(), middle->y())); VC c = q.vertices_circulator(); q.set(c, *middle); q.insert(c, Point(2,3)); q.erase(q.vertices_circulator()); pgn.push_back(Point(pgn.vertices_begin()->x(), 3)); pgn.set(pgn.vertices_begin(), Point(pgn.vertices_begin()->x(), 3)); q.insert(q.vertices_begin(), pvec.begin() + 3, pvec.begin() + 7); q.insert(q.vertices_circulator(), pvec.begin() + 3, pvec.begin() + 7); q.clear(); }
void ListPolyIt::convertPolygonToList(PolygonRef poly, ListPolygon& result) { #ifdef DEBUG Point last = poly.back(); #endif // DEBUG for (Point& p : poly) { result.push_back(p); #ifdef DEBUG // usually polygons shouldn't have such degenerate verts // in PolygonProximityLinker (where this function is (also) used) it is // required to not have degenerate verts, because verts are mapped // to links, but if two different verts are at the same place the mapping fails. assert(p != last); last = p; #endif // DEBUG } }