Minor changes to MedialAxis code

This commit is contained in:
Alessandro Ranellucci 2016-12-21 19:48:39 +01:00
parent 27b2f0d6c3
commit 357b6bbd55
2 changed files with 8 additions and 7 deletions

View File

@ -474,14 +474,21 @@ MedialAxis::build(ThickPolylines* polylines)
/* /*
// DEBUG: dump all Voronoi edges // DEBUG: dump all Voronoi edges
{ {
SVG svg("voronoi.svg");
svg.draw(*this->expolygon);
for (VD::const_edge_iterator edge = this->vd.edges().begin(); edge != this->vd.edges().end(); ++edge) { for (VD::const_edge_iterator edge = this->vd.edges().begin(); edge != this->vd.edges().end(); ++edge) {
if (edge->is_infinite()) continue; if (edge->is_infinite()) continue;
ThickPolyline polyline; ThickPolyline polyline;
polyline.points.push_back(Point( edge->vertex0()->x(), edge->vertex0()->y() )); polyline.points.push_back(Point( edge->vertex0()->x(), edge->vertex0()->y() ));
polyline.points.push_back(Point( edge->vertex1()->x(), edge->vertex1()->y() )); polyline.points.push_back(Point( edge->vertex1()->x(), edge->vertex1()->y() ));
polyline.width.push_back(this->max_width);
polyline.width.push_back(this->max_width);
polylines->push_back(polyline); polylines->push_back(polyline);
svg.draw(polyline);
} }
svg.Close();
return; return;
} }
*/ */

View File

@ -43,13 +43,7 @@ class MedialAxis {
void build(Polylines* polylines); void build(Polylines* polylines);
private: private:
class VD : public voronoi_diagram<double> { typedef voronoi_diagram<double> VD;
public:
typedef double coord_type;
typedef boost::polygon::point_data<coordinate_type> point_type;
typedef boost::polygon::segment_data<coordinate_type> segment_type;
typedef boost::polygon::rectangle_data<coordinate_type> rect_type;
};
VD vd; VD vd;
std::set<const VD::edge_type*> edges, valid_edges; std::set<const VD::edge_type*> edges, valid_edges;
std::map<const VD::edge_type*, std::pair<coordf_t,coordf_t> > thickness; std::map<const VD::edge_type*, std::pair<coordf_t,coordf_t> > thickness;