Created
February 19, 2015 20:01
-
-
Save Rogach/1fbf782d843e92f694d3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string> | |
#include <iostream> | |
#include <openvoronoi/medial_axis_filter.hpp> | |
#include <openvoronoi/medial_axis_walk.hpp> | |
#include <openvoronoi/voronoidiagram.hpp> | |
#include <openvoronoi/polygon_interior_filter.hpp> | |
#include <openvoronoi/utility/vd2svg.hpp> | |
#include <openvoronoi/version.hpp> | |
int main() { | |
ovd::VoronoiDiagram* vd = new ovd::VoronoiDiagram(1,100); // (r, bins) | |
ovd::Point p1(0.15907424869091413, -0.22755592000227737); | |
ovd::Point p2(-0.158774429631718, -0.22755592000227737); | |
ovd::Point p3(-0.158774429631718, 0.5000000000000007); | |
ovd::Point p6(0.44085019690616595, -0.4999999999999993); | |
ovd::Point p7(0.44085019690616595, 0.4999999999999993); | |
int v1 = vd->insert_point_site(p1); | |
int v2 = vd->insert_point_site(p2); | |
int v3 = vd->insert_point_site(p3); | |
int v6 = vd->insert_point_site(p6); | |
int v7 = vd->insert_point_site(p7); | |
vd->insert_line_site(v1, v2); | |
vd->insert_line_site(v2, v3); | |
vd->insert_line_site(v6, v7); | |
vd->check(); | |
// save drawing to svg file. | |
svg::Dimensions dimensions(1024, 1024); | |
svg::Document doc("medial_axis.svg", svg::Layout(dimensions, svg::Layout::BottomLeft)); | |
ovd::HEGraph& g = vd->get_graph_reference(); | |
BOOST_FOREACH( ovd::HEEdge e, g.edges() ) { | |
if( g[e].valid ) write_edge_to_svg(g,doc,e); | |
} | |
doc.save(); | |
delete vd; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment