我正在尝试基于地理坐标实现管状结构,数据是json格式,看起来像这样。
[
{
"LATITUDE": "55.10185525",
"LONGITUDE": "-76.4629527"
},
{
"LATITUDE": "55.10181625",
"LONGITUDE": "-76.4629827"
},
{
"LATITUDE": "55.10185525",
"LONGITUDE": "-76.4629527"
},
{
"LATITUDE": "55.10181625",
"LONGITUDE": "-76.4629827"
},
{
"LATITUDE": "55.10185525",
"LONGITUDE": "-76.4329527"
},
{
"LATITUDE": "55.10181625",
"LONGITUDE": "-76.4629827"
},
{
"LATITUDE": "55.10185525",
"LONGITUDE": "-76.4629527"
},
{
"LATITUDE": "55.10181625",
"LONGITUDE": "-76.4629827"
}
我使用这种转换方法来创建Three js Vector3
function convertLatLonToVec3(lat,lon) {
lat = lat * Math.PI / 180.0;
lon = -lon * Math.PI / 180.0;
return new THREE.Vector3(
Math.cos(lat) * Math.cos(lon),
Math.sin(lat),
Math.cos(lat) * Math.sin(lon));
}; 但这不是很好。所以还有其他方法在3d平面上实现lat long