2014-11-02 3 views
0

구형 좌표를 사용하여 평면 메쉬를 구부려 고합니다. 위키피디아의 토큰 수식과 거의 비슷합니다! 그러나 일부 꼭지점은 같은 위치에 배치됩니다.Three.js - 구형 좌표가있는 굽힘 평면

하기 전에 : http://hpics.li/78c0871

후 : 메쉬 평면이 여기에 결과를 볼 수, 0, 0, 0에 배치됩니다

@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://hpics.li/19ada1a

그리고 내 코드입니다

도움에 감사드립니다!

+0

좋아, 난 여기에 메르카토르 투영과 해결책을 발견 : http://stackoverflow.com/questions/ 12732590/how-map-2d-grid-points-xy-to-sphere-3d-points-xyz – Tiramitsu

답변

관련 문제