javascript - 将笛卡尔坐标缩放到平面
问题描述
我有一组笛卡尔坐标,我试图在平面上显示,但一起显示。
我这样做是为了展示:
//coordinates
var coords = [{x: 38.312994420265, z: -6.73293614518871 },
{ x: 38.3121606727708, z: -6.73414861996415 },
{ x: 38.31209393925, z: -6.73365394789821 },
{ x: 38.309765, z: -6.733786 },
{ x: 38.3098334832724, z: -6.73374153262405 },
{ x: 38.3101738571429, z: -6.73400842857143 },
{ x: 38.3098832732111, z: -673400942857143 },
{ x: 38.31065825, z: -6.73382525 },
{ x: 38.3121424443978, z: -6.73440437325536 },
{ x: 38.312321, z: -6.734591 },
{ x: 38.3135465825497, z: -6.73486983169236 }];
//load scene and set center coordinate
function CargarCamara() {
scene = new THREE.Scene();
scene.position.set(38.313,0,-6.735);
//camera
camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 1000);
camera.position.set(0, 300, 500);
camera.lookAt(scene.position);
//lights
light = new THREE.PointLight(0xffffff, 1, 4000);
light.position.set(50, 0, 0);
light_two = new THREE.PointLight(0xffffff, 1, 4000);
light_two.position.set(-100, 800, 800);
lightAmbient = new THREE.AmbientLight(0x404040);
scene.add(light, light_two, lightAmbient);
}
//set cardinal points
function Cubo() {
const bola = new THREE.SphereGeometry(5);
const meta = new THREE.MeshBasicMaterial({ color: 0x0000ff });
const punto = new THREE.Mesh(bola, meta);
for (let i = 0; i < (coords.length - 1); i++) {
let aux = punto.clone();
aux.position.set((coords[i].x - scene.position.x ), 10, (coords[i].z - scene.position.y ));
coordenadas.add(aux);
}
scene.add(coordenadas);
}
我也有这个问题。
我怎样才能将该坐标缩放到我的飞机上?
解决方案
推荐阅读
- laravel - 如何从 Laravel 中的同一张表创建多级类别树
- python - 如何使用 OSMNX 包从多边形中获取图形?
- android - 从 Cordova android 应用程序下载 .xlsx 文件时出现问题
- content-management-system - Umbraco CMS 问题:类型 'IEnumerable<>' 在未引用的程序集中定义
- python - 使用 Python 获取 PDF 附件
- c# - JSON 到 XML:如何避免特殊字符编码 # 到 _x0023_?
- elasticsearch - Feathersjs 中 Elasticsearch 数据库适配器的模糊搜索
- asp.net - 在列表中添加表单数据(点网核心)
- buildpack - 如何为生命周期提供注册表凭据
- c# - 不同 PC 上 COM 对象的不同代码行为和不同 LegacyIAccessible 属性