0
function labelBox에 사용 된이 코드 줄 this.position = convertlatlonToVec3(cardinal.lat, cardinal.lon).multiplyScalar(radius);
을 이해할 수 없습니다. multiplyScalar (radius)는 어떻게 작동합니까?JavasScript를 사용하여 다음 수식의 실행을 이해할 수 없습니다.
function convertlatlonToVec3(lat, lon)
{
var cosLat = Math.cos(circle.getCenter().lat() * degrees);
var sinLat = Math.sin(circle.getCenter().lat() * degrees);
var xSphere = radiusEquator * cosLat;
var ySphere = 0;
var zSphere = radiusPoles * sinLat;
var rSphere = Math.sqrt(xSphere*xSphere + ySphere*ySphere + zSphere*zSphere);
var tmp = rSphere * Math.cos(lat * degrees);
xSphere = tmp * Math.cos((lon - circle.getCenter().lng()) * degrees);
ySphere = tmp * Math.sin((lon - circle.getCenter().lng()) * degrees);
zSphere = rSphere * Math.sin(lat * degrees);
var x = -ySphere/circle.getRadius();
var y = (zSphere*cosLat - xSphere*sinLat)/circle.getRadius();
var z = 0;
return new THREE.Vector3(x, y, z);
}
function labelBox(cardinal, radius, root)
{
this.screenvector = new THREE.Vector3(0,0,0);
this.labelID = 'MovingLabel'+ cardinal.ID;
this.position = convertlatlonToVec3(cardinal.lat, cardinal.lon).multiplyScalar(radius);
}
'convertlatlonToVec3' 반환'새로운 THREE.Vector3는 (X, Y, Z)'...이 아마 방법이있다 'multiplyScalar'라고 불리는 것 - 나중에 실행 됨 –
@Jaromanda X 어떻게 multiplyScalar (radius)가 작동하는지 알아야합니다. – lakers1234
이제 질문을 변경했습니다. 세 설명서를 보았습니까? –