SVG:简化路径以删除曲线?

发布于 2024-11-16 10:28:35 字数 218 浏览 3 评论 0原文

我有一个 svg 文件,其中包含带有贝塞尔曲线的复杂路径。 我需要转换此路径数据以将其用于 html 地图区域,所以实际上我只需要坐标(但对于大曲线,在两个端点之间有一些坐标会非常好。

我尝试了 Inkscape 的简化路径功能,但这些路径仍然包含曲线...

是否有任何工具或公式可以将这些曲线转换为简单坐标?

也许是另一种在坐标中不使用曲线的 Inkscape 输出格式?

I have a svg file which contains complex paths with bezier curves in it.
I need to convert this path-data to use it for html map-area's, so I in fact I need just the coordinates (but for large curves, it would be very nice to have some coordinates 'between' the two end-points.

I tried Inkscape's simplify path function, but those paths still contain curves...

Is there any tool or formula to convert these curves into simple coordinates?

Maybe another Inkscape output-format that doesn't use curves in its coordinates?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

残花月 2024-11-23 10:28:35

在 Inkscape 中:

  1. 选择按节点编辑路径工具 (F2)
  2. 单击路径将其选中
  3. Ctrl + A 选择该路径中的所有节点
  4. 单击将新节点插入所选段。重复此操作以根据需要详细地表示曲线的形状。
  5. 然后单击制作选定的线段

这些选项位于顶部的工具栏上 - 加号图标和两个方形节点之间的直线对角线。

In Inkscape:

  1. Select the Edit Path By Nodes tool (F2)
  2. Click on your path to select it
  3. Ctrl + A to select all the nodes in that path
  4. Click the Insert new nodes into selected segments. Repeat this to represent the shape of the curve/s in as much detail as you need.
  5. Then click Make Selected Segments Lines

These options are on the toolbar at the top - the plus icon and the straight diagonal line between two square nodes.

screenshot of make selected segments lines

还如梦归 2024-11-23 10:28:35

对于自动化,请尝试 Inkscape 中包含的 Flatten Bezier 扩展。说明此处

For automation, try the included Flatten Bezier extension in Inkscape. Description here.

贱人配狗天长地久 2024-11-23 10:28:35

有更多技术方法可以简化 SVG 路径 - https://github.com/mattdesl/simplify-path< /a>

var path = [ [250, 150], [250, 150], [25, 25], [24, 25], [10, 10] ]
var tolerance = 10
path = simplify(path, tolerance)
//result:
//[ [ 250, 150 ], [ 25, 25 ], [ 10, 10 ] ]

There is more technical way to simplify SVG path - https://github.com/mattdesl/simplify-path

var path = [ [250, 150], [250, 150], [25, 25], [24, 25], [10, 10] ]
var tolerance = 10
path = simplify(path, tolerance)
//result:
//[ [ 250, 150 ], [ 25, 25 ], [ 10, 10 ] ]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文