绘制 2D 隐式标量场的 iso 线

发布于 2024-07-08 08:22:23 字数 431 浏览 11 评论 0原文

我有一个在 2D 中定义的隐式标量场,对于 2D 中的每个点,我可以让它计算一个精确的标量值,但它的计算有点复杂。
我想绘制该表面的等值线,即“0”值的线。 函数本身是连续的,但“0”等值线可以有多个连续实例,并且不能保证所有实例都是相连的。
计算每个像素的值不是一种选择,因为这会花费太多时间 - 大约几秒钟,并且需要尽可能实时。

我目前使用的是空间的递归划分,可以将其视为一种四叉树。 我对空间进行初始、非常粗略的采样,如果我发现一个包含从正值到负值的过渡的正方形,我会递归地将其划分为 4 个较小的正方形并再次检查,在像素级别停止。 通过对正方形的 4 个角进行采样来检测正负转换。 这工作得相当好,除非它不起作用。 绘制的等值线有时会被切断,因为对于发生在边缘的小区域且不穿过正方形角的过渡,过渡检测失败。

在此设置中是否有更好的方法来绘制等值线?

I have an implicit scalar field defined in 2D, for every point in 2D I can make it compute an exact scalar value but its a somewhat complex computation.
I would like to draw an iso-line of that surface, say the line of the '0' value. The function itself is continuous but the '0' iso-line can have multiple continuous instances and it is not guaranteed that all of them are connected.
Calculating the value for each pixel is not an option because that would take too much time - in the order of a few seconds and this needs to be as real time as possible.

What I'm currently using is a recursive division of space which can be thought of as a kind of quad-tree. I take an initial, very coarse sampling of the space and if I find a square which contains a transition from positive to negative values, I recursively divide it to 4 smaller squares and checks again, stopping at the pixel level. The positive-negative transition is detected by sampling a sqaure in its 4 corners.
This work fairly well, except when it doesn't. The iso-lines which are drawn sometimes get cut because the transition detection fails for transitions which happen in a small area of an edge and that don't cross a corner of a square.

Is there a better way to do iso-line drawing in this settings?

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

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

发布评论

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

评论(1

微凉 2024-07-15 08:22:23

我使用此处描述的算法取得了很大的成功 http://web.archive.org/web/20140718130446/http://members.bellatlantic.net/~vze2vrva/thesis.html
其中讨论了自适应轮廓(类似于您所描述的),以及一般轮廓绘制的一些其他问题。

没有通用的方法可以保证在不查看每个像素的情况下找到函数的所有轮廓。 可能存在非常小的闭合轮廓,其中函数为正的区域仅大约像素大小,而函数通常为负的区域。 除非您采样得足够精细,将样本放置在正区域内,否则没有通用方法可以知道它在那里。

如果您的函数足够平滑,您也许能够猜测出如此小的闭合轮廓所在的位置,因为函数的模在它们周围的区域中变小。 然后可以仅在这些区域中细化抽样。

I've had a lot of success with the algorithms described here http://web.archive.org/web/20140718130446/http://members.bellatlantic.net/~vze2vrva/thesis.html
which discuss adaptive contouring (similar to that which you describe), and also some other issues with contour plotting in general.

There is no general way to guarantee finding all the contours of a function, without looking at every pixel. There could be a very small closed contour, where a region only about the size of a pixel where the function is positive, in a region where the function is generally negative. Unless you sample finely enough that you place a sample inside the positive region, there is no general way of knowing that it is there.

If your function is smooth enough, you may be able to guess where such small closed contours lie, because the modulus of the function gets small in a region surrounding them. The sampling could then be refined in these regions only.

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