0
我嘗試使用球座標來彎曲平面網格。我在維基百科的令牌公式,它幾乎工作! 但是有些頂點被定位在同一個地方。 網狀平面放置在0,0,0,你可以看這裏的結果:Three.js - 帶有球座標的彎曲平面
這裏是我的代碼:
@radius = 4
@oPhi = 0
@oTheta = 0
projection : (vertice) ->
p = Math.sqrt(vertice.x ** 2 + vertice.y ** 2)
c = Math.asin(p/@radius)
phi = Math.asin(Math.cos(c) * Math.sin(@oPhi) + (vertice.y * Math.sin(c) * Math.cos(@oPhi)/p))
theta = @oTheta + Math.atan((vertice.x * Math.sin(c))/(p * Math.cos(@oPhi) * Math.cos(c) - vertice.y * Math.sin(@oPhi) * Math.sin(c)))
vertice.x = @radius * Math.sin(phi) * Math.cos(theta)
vertice.z = @radius * Math.sin(phi) * Math.sin(theta)
vertice.y = @radius * Math.cos(phi)
感謝您的幫助!
好吧,我發現與墨卡託投影這裏的解決方案: http://stackoverflow.com/questions/ 12732590 /如何映射-2D網格點-XY-到球-AS-3D點-XYZ – Tiramitsu 2014-11-02 13:51:43