algorithm - 在地形图上绘制道路

标签 algorithm opengl openstreetmap heightmap

我有道路左侧和右侧的顶点坐标(显示为绿色和黑色点)。我的地形是一个数组,正方形的角代表不同的高度值。我只是通过为每个顶点提供插值高度来绘制我的道路,但这并没有给出正确的结果(道路不与地形重叠)

问题:在opengl中有什么方法可以正确绘制这条路吗?或者我必须手动计算所有交叉点(蓝点)并镶嵌我的道路?

Sample Image

**编辑:**如果我只给每个顶点一个插值高度,这就是结果。正如所见,由于高度图,某些部分仍处于地形之下。

enter image description here

最佳答案

这是我为实现结果所做的算法:

对于每条路:

1) Generate Initial vertexes from road Lines
2) Find Intersections Vertically and add in order to the buffer   
3) Find Intersections Horizontally and add in order to the buffer
4) Find Intersections Diagonally and add in order to the buffer
5) Find texture coordinates for each vertex in buffer

在我们按顺序排列顶点后,我将它传递给 Tesselator 以绘制最终的凹多边形。瞧! enter image description here

关于algorithm - 在地形图上绘制道路,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29055755/

相关文章:

algorithm - A* map 分割算法

java - 以这种方式找到排列的复杂性是什么?

java - 基于字典的字符串匹配算法 - Java

c++ - 指向特征数据 `std::list` 的指针

caching - 如何清除我自己服务器上的所有 osm 磁贴缓存

algorithm - 关于随机数序列生成

java - OpenGL 的关键。 Java/斯卡拉/ python

c++ - 将 C++ 容器提供给 OpenGL?

javascript - 每个标记有多个类别选项在传单 map 中使用 GeoJSON