计算 3D 高度图的轮廓?
我正在寻找一个函数或示例来生成表示高度图中特定高度处的轮廓的线条列表。
例如,
Lines[] = GetContours(Heights[512,512], HeightValue)
其中 Heights 是 512x512 浮点值数组,HeightValue 是应绘制轮廓的高度。 高度可能包含该特定高度的多条线(例如马鞍或岛链)
是否有人拥有或知道在哪里可以获得生成此高度的算法?
I am looking for a function or example to produce a list of lines representing contours at a specific height within a heightmap.
Eg,
Lines[] = GetContours(Heights[512,512], HeightValue)
Where Heights is a 512x512 array of floating point values, HeightValue is the height at which the contour should be drawn. Heights may contain multiple lines for that specific height (eg a Saddle, or island chain)
Does anyone have or know where to get an algorithm to generate this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
你实际上想做的是绘制一条等值线。
请参阅我的问题不久前.
给出的链接其中一个答案非常有帮助。
What you're actually trying to do is to draw an iso-line.
see my question about it a while ago.
The link given in one of the answers was very helpful.
标准算法是行进方块。
The standard algorithm is marching squares.
算法:
a) 查找哪些多边形的顶点高于和低于您感兴趣的高度。
b) 将这些多边形的边与平面相交以获得平面上的线。
c) 将线条以条状连接在一起。
Algorithm:
a) Find which polygons have vertices above&below the height you're interested in.
b) Intersect the edges of those polygons with the plane to get lines on the plane.
c) Join the lines together in strips.
看一下 Srtm2Osm,这是我用来从 NASA 的 SRTM 生成轮廓的工具数据。 您可以在 C# 代码中找到该算法。
Take a look at Srtm2Osm, a tool I've made to generate contours from NASA's SRTM data. You can find the algorithm in the C# code.