gpt4 book ai didi

c++ - 如何从 svg 读取 boost::geometry::model::polygon

转载 作者:行者123 更新时间:2023-11-30 05:24:09 29 4
gpt4 key购买 nike

我可以像这样将 boost::geometry::model::polygon 写入 svg:

#include <iostream>
#include <fstream>

#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/io/svg/svg_mapper.hpp>

typedef boost::geometry::model::d2::point_xy<double> point_type;
typedef boost::geometry::model::polygon<point_type> polygon_type;

int main()
{
polygon_type polygon;

polygon.outer().push_back(point_type{10,10});
polygon.outer().push_back(point_type{11,10});
polygon.outer().push_back(point_type{10,11});
polygon.outer().push_back(point_type{10,10});

std::ofstream svg("test.svg");

boost::geometry::svg_mapper<point_type> mapper(svg, 400, 400);
mapper.add(polygon);
mapper.map(polygon, "fill:rgb(255,128,0);stroke:rgb(0,0,100);stroke-width:1");

return 0;
}

但是,我好像找不到逆运算。也就是说,我有一个 .svg,现在如何将它读入 boost::geometry::model::polygon?

最佳答案

正如@sehe 所指出的,没有可用的 SVG 阅读器。

关于c++ - 如何从 svg 读取 boost::geometry::model::polygon,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38803806/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com