绘制二维隐式标量场的 iso 线 [英] Drawing an iso line of a 2D implicit scalar field

查看:25
本文介绍了绘制二维隐式标量场的 iso 线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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.

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

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?

推荐答案

我使用这里描述的算法取得了很大的成功 http://web.archive.org/web/20140718130446/http://members.bellatlantic.net/~vze2vrva/论文.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.

这篇关于绘制二维隐式标量场的 iso 线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆