使用GPS坐标将自定义对象放置到查看器空间中 [英] Place a custom object into viewer space using GPS coords

查看:163
本文介绍了使用GPS坐标将自定义对象放置到查看器空间中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用从无人机调查获得的数据将标记对象放置在模型上.我可以访问高精度GPS数据以及omega/phi/kappa旋转数据.

I am placing marker objects on a model using data taken from drone surveys. I have access to high accuracy GPS data and also omega/phi/kappa rotation data.

目标是在选择照片时将查看器的相机移到适当的位置,以便我们从照片中可以很好地看到模型的那部分.

The goal is to move the viewer camera into position when I select a photo, so that we get a fairly good view of that part of the model from the photo.

到目前为止,我们正在使用单个模型,并且我想验证自己是否正确使用了转换,从而可以与其他模型一起使用.另外,我需要使用omega/phi/kappa匹配相机方向,并且我想知道是否还需要转换方向数据.

So far, we are working with a single model and I want to verify that I'm using the transforms correctly so that this works with other models. Also, I need to match camera orientation using omega/phi/kappa, and I want to know if I also need to transform orientation data.

该模型最初来自Revit.

The model comes from Revit originally.

这是我到目前为止使用NOP_VIEWER.model.getData()发现的各种变换.

Here are the various transforms I have found so far using NOP_VIEWER.model.getData().

  1. GlobalOffset (向量3)
  2. placementWithOffset (Matrix4)-似乎只是 GlobalOffset 的逆矩阵?
  3. placementTransform (Matrix4)-通常未定义,我已经看到一些暗示,这是用户定义的矩阵.
  4. refPointTransform (Matrix4)
  1. GlobalOffset (Vector3)
  2. placementWithOffset (Matrix4) - seems to be just the inverse of GlobalOffset as a matrix?
  3. placementTransform (Matrix4) - generally undefined, I've seen some hints that this is a user defined matrix.
  4. refPointTransform (Matrix4)

此外,NOP_VIEWER.model.getData().metadata中有一些转换:

  1. metadata.georeference.positionLL84 (数组[3])-这是模型的GPS坐标存储位置
  2. metadata.georeference.refPointLMV (Array [3])-不知道这是什么,并且在许多模型中它都有巨大且看似随机的值.例如,在我当前的模型上是[-17746143.211481072, -6429345.318822183, 27.360225423452952]
  3. 元数据.[自定义值] .angleToTrueNorth -我想这是在指定模型是对准真北还是磁北?
  4. 元数据.[自定义值] .refPointTransform -(Array [12])-用于在上方创建refPointTransform矩阵的数据
  1. metadata.georeference.positionLL84 (Array[3]) - this is where the model's GPS coords are stored
  2. metadata.georeference.refPointLMV (Array[3]) - no idea what this is, and it has huge and seemingly random values on many models. For example, on my current model it is [-17746143.211481072, -6429345.318822183, 27.360225423452952]
  3. metadata.[custom values].angleToTrueNorth - I guess this is specifying whether the model is aligned to true or magnetic north?
  4. metadata.[custom values].refPointTransform - (Array[12]) - data used to create the refPointTransform matrix above

通过以下步骤,我已经能够将位置数据导入查看器空间:

I have been able to get the position data into viewer space using these steps:

  1. 使用Autodesk.geolocation扩展名lonLatToLmv函数将lon/lat/alt转换为查看者坐标.
  2. 获取转换后的数据并应用各种变换,直到将其正确放置在模型空间中为止.
  1. Use the Autodesk.geolocation extension lonLatToLmv function to convert lon/lat/alt to viewer coords.
  2. Take the converted data and apply various transforms until it is correctly positioned in model space.

const gpsPosition = new THREE.Vector3(
  longitude,
  latitude,
  altitude,
);

const position = viewer
  .getExtension('Autodesk.Geolocation')
  .lonLatToLmv(gpsPosition);

const data = viewer.model.getData();

const globalOffset = data.globalOffset;
const refPointTransform = data.refPointTransform;
const angleToTrueNorth = THREE.Math.degToRad(
    data.metadata['custom values'].angleToTrueNorth
);

// applying the transform

position.add(globalOffset)
position.applyMatrix4(refPointTransform);

// finally, rotate the position based on angle to true north. 

const quaterion = new THREE.Quaternion().setFromEuler(
  new THREE.Euler(0, 0, -angleToTrueNorth),
);

position.applyQuaternion(quaterion);

问题:

  1. 我还需要对旋转数据应用一些变换吗?
  2. 我正确应用了转换吗?

计算出data.refPointTransform矩阵已经对angleToTrueNorth进行了编码,因此在两次应用该函数时,我显然做错了.

figured out that the data.refPointTransform matrix already encodes the angleToTrueNorth, so I'm clearly doing something wrong in applying that twice.

我目前无法访问无人驾驶飞机的照片数据,这些照片数据是将它们对准真北还是磁北,但我认为它是真北.

I don't currently have access to the drone photo data specifying whether they are aligned to true or magnetic north, I assume it's true north though.

推荐答案

您发现的地理位置参数是内部的,不应直接使用,特别是因为不同的输入文件格式(Revit,IFC,Navisworks等) )可以以不同的形式输出此信息.使用地理位置扩展(如您在示例代码中所做的那样)及其方法lonLatToLmv应该为您提供映射到场景坐标系中的最终纬度/经度/纬度值.如果没有,请将示例文件和您的代码片段发送给我们forge (dot) help (at) autodesk (dot) com,我们将对此进行调查.

The geo-positioning params you've discovered are internal and shouldn't be used directly, especially since different input file formats (Revit, IFC, Navisworks, etc) may output this information in different forms. Using the geolocation extension (as you do in your example code) and its method lonLatToLmv should give you the final lat/long/alt value mapped into the scene coordinate system. If it doesn't, please send us a sample file and the snippet of your code to forge (dot) help (at) autodesk (dot) com and we will investigate it on our end.

对于您发现的各种xform属性:

As far as the various xform properties you found:

    当模型的顶点数据移至靠近原点时,有时会在模型上定义
  • globalOffset ,以避免精度问题
  • placementWithOffset 是通过将 globalOffset 应用于 placementTransform
  • 进行内部计算的
  • placementTransform 是一个可选参数,可以在加载模型时传递给它;转换将应用于模型中单个元素的所有xforms
  • refPointTransform 是另一种元数据类型,当 globalOffset 不够时,有时可以在模型上定义(通常是从AEC设计转换而来)
  • globalOffset is sometimes defined on the model when the vertex data of the model is moved close to origin to avoid precision issues
  • placementWithOffset is internally computed by applying globalOffset to placementTransform
  • placementTransform is an optional parameter that can be passed in when loading a model; the transformation will be applied to all xforms of individual elements in the model
  • refPointTransform is another type of metadata that can sometimes be defined on models (typically converted from AEC designs) when globalOffset is not sufficient

这篇关于使用GPS坐标将自定义对象放置到查看器空间中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆