如何在 FlattenPathGeometry 上的 Point.Y 处获取 Point.X - WPF

发布于 2024-12-09 05:49:36 字数 118 浏览 6 评论 0原文

我有一个“FlattenedPathGeometry”,我希望能够从基于特定 Point.Y 的路径中获取特定 point.X

基本上我只需要任何给定 Y 处的 X 值。

提前感谢您的帮助。

I have a "FlattenedPathGeometry" and I want to be able to get a specific point.X from the path based on a specific Point.Y

Basically I just need the X value at any given Y.

Thanks in advance for any help.

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

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

发布评论

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

评论(1

星軌x 2024-12-16 05:49:36

GetFlattenedPathGeometry 给你返回一个多边形,所以基本上你必须考虑循环所有点并计算到你的点的最小距离。
如果您可以对几何形状或您的点做出任何假设,则可以加快搜索速度。

例如,如果路径很长,您可以通过将形状与以点为中心的圆形/正方形相交来加速。这限制了要测试的形状的点数,但要注意相交方法的成本非常高。您必须使用秒表来测量性能,才能了解您的情况下什么更好。

GetFlattenedPathGeometry gives you back a polygonal so basically you have to consider loop all the points and calculating the minimum distance to your point.
If you can make any assumption on the Geometry shape or your point, you can speed up the search.

For example if the path is very long, you can speed up by intersecting the shape with a circle/square centered in your point. This limit the number of points of the shape to test but be careful that the intersection method is very expensive. You'll have to measure the performances with a stopwatch to understand what's better in your case.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文