void GDALParceling::split_left(Point_2 & p3, Pwh_list_2 & ress, Point_2 & p2, Point_2 & p4, Point_2 & p1, Vector_2 & v1)
{
	Polygon_with_holes_2 split_left;
	split_left.outer_boundary().push_back(p1);
	split_left.outer_boundary().push_back(p1+v1);
	split_left.outer_boundary().push_back(p4+v1);
	split_left.outer_boundary().push_back(p4);
	ress.push_back(split_left);

	//Right
	Polygon_with_holes_2 split_right;
	split_right.outer_boundary().push_back(p2-v1);
	split_right.outer_boundary().push_back(p2);
	split_right.outer_boundary().push_back(p3);
	split_right.outer_boundary().push_back(p3-v1);
	ress.push_back(split_right);
}
void GDALParceling::split_up(Pwh_list_2 & ress, Point_2 & p3, Point_2 & p1, Point_2 & p4, Vector_2 & v2, Point_2 & p2)
{
	Polygon_with_holes_2 split_left_1;
	split_left_1.outer_boundary().push_back(p1);
	split_left_1.outer_boundary().push_back(p2);
	split_left_1.outer_boundary().push_back(p2+v2);
	split_left_1.outer_boundary().push_back(p1+v2);
	ress.push_back(split_left_1);

	//Right
	Polygon_with_holes_2 split_right_1;
	split_right_1.outer_boundary().push_back(p3-v2);
	split_right_1.outer_boundary().push_back(p3);
	split_right_1.outer_boundary().push_back(p4);
	split_right_1.outer_boundary().push_back(p4-v2);
	ress.push_back(split_right_1);
}
Exemplo n.º 3
0
void
arrangement::admissible_configuration(Op2_it pgn, std::vector<Offset_polygon_with_holes_2> &off,Pwh_list_2 &adm)
{
    Offset_polygon_with_holes_2 poly(*pgn);
    std::vector<Offset_polygon_with_holes_2> polys;
    polys.push_back(poly);

    for (int i =0; i< (int) polys.size(); ++i)
    if (polys[i].outer_boundary().orientation() == -1)
            polys[i].outer_boundary().reverse_orientation();

    for (int i =0; i< (int)polys.size(); ++i)
    {
        int before;
        bool flag = false;
        for (int k = 0; k < (int)off.size(); ++k)
        {
            if (off[k].outer_boundary().orientation() == -1)
                off[k].outer_boundary().reverse_orientation();

            if (CGAL::do_intersect(polys[i], off[k]))
            {
                flag = true;
                before = (int) adm.size();
                CGAL::difference(polys[i], off[k],std::back_inserter(adm));
                polys.pop_back();
                int cpt_tmp = (int)adm.size();
                for (int j = before; j < cpt_tmp; ++j)
                {
                    polys.push_back(adm.back());
                    adm.pop_back();
                }
            }
        }
        if (flag)
            --i;
    }
    for (int k = 0; k < (int)polys.size(); ++k)
        adm.push_back(polys[k]);
}