inline void make_comb(Polygon& polygon, AddFunctor functor, int count, bool close = true, bool clockwise = true) { int n = 0; if (! clockwise) { typedef boost::tuple<double, double> tup; typedef std::vector<tup> vector_type; vector_type vec; // Create in clockwise order make_comb(vec, ccw_pushback<vector_type>, count, close, true); // Add in reverse // (For GCC 3.4 have it const) vector_type const& v = vec; for (vector_type::const_reverse_iterator it = v.rbegin(); it != v.rend(); ++it) { functor(polygon, it->get<0>(), it->get<1>(), n++); } return; } // Create comb functor(polygon, 25.0, 0.0, n++); functor(polygon, 0.0, 25.0, n++); functor(polygon, 25.0, 50.0, n++); // Function parameters double diff = (25.0 / (count - 0.5)) / 2.0; double b1 = -25.0; double b2 = 25.0 - diff * 2.0; double x1 = 50.0, x2 = 25.0; for (int i = 0; i < count - 1; i++) { functor(polygon, x1, (x1 + b1), n++); x1 -= diff; functor(polygon, x1, (x1 + b1), n++); x1 -= diff; functor(polygon, x2, (x2 + b2), n++); x2 -= diff; functor(polygon, x2, (x2 + b2), n++); x2 -= diff; } functor(polygon, x1, (x1 + b1), n++); if (close) { functor(polygon, 25.0, 0.0, 4); } }
void test_star_comb(int star_point_count, int comb_comb_count, double factor1, double factor2, bool do_union, p_q_settings const& settings) { Polygon star, comb; make_star(star, add<Polygon>, star_point_count, factor1, factor2); make_comb(comb, add<Polygon>, comb_comb_count); std::ostringstream out; out << "star_comb"; test_overlay_p_q < Polygon, typename bg::coordinate_type<Polygon>::type >(out.str(), star, comb, settings); }