gpt4 book ai didi

algorithm - Marching Squares Algorithm 的位移步骤

转载 作者:塔克拉玛干 更新时间:2023-11-03 06:12:21 28 4
gpt4 key购买 nike

我目前正在实现 Marching Squares用于计算等高线曲线,我对此处提到的位移位的使用有疑问

Compose the 4 bits at the corners of the cell to build a binary index: walk around the cell in a clockwise direction appending the bit to the index, using bitwise OR and left-shift, from most significant bit at the top left, to least significant bit at the bottom left. The resulting 4-bit index can have 16 possible values in the range 0–15.

我将高度数据放置在指定 (x,y) 处每个顶点的角上。然后,我通过执行检查以查看此高度数据是大于还是小于指定的等值(例如轮廓水平),将此高度数据转换为 0 和 1。现在顶点不是 0 就是 1。下一步即通过顺时针方向遍历计算 4 位索引的目的是什么?

最佳答案

编写四位代码的目的只是为了识别配置,十六种情况之一。

您完全可以改用四个嵌套的 if/then/else 语句。

关于algorithm - Marching Squares Algorithm 的位移步骤,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46873869/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com