Convert a bounding box in ECEF coordinates to ENU coordinates

霸气de小男生 提交于 2019-12-02 07:14:38
  1. transform matrix

    first thing is to understand that transform matrix represents coordinate system. Look here Transform matrix anatomy for another example.

    In standard OpenGL notation If you use direct matrix then you are converting from matrix local space (LCS) to world global space (GCS). If you use inverse matrix then you converting coordinates from GCS to LCS

  2. camera matrix

    camera matrix converts to camera space so you need the inverse matrix. You get camera matrix like this:

    camera=inverse(camera_space_matrix)
    

    now for info on how to construct your camera_space_matrix so it fits the bounding box look here:

    so compute midpoint of the top rectangle of your box compute camera distance as max of distance computed from all vertexes of box so

    camera position = midpoint + distance*midpoint_normal
    

    orientation depends on your projection matrix. If you use gluPerspective then you are viewing -Z or +Z according selected glDepthFunc. So set Z axis of matrix to normal and Y,X vectors can be aligned to North/South and East/West so for example

    Y=Z x (1,0,0)
    X = Z x Y
    

    now put position, and axis vectors X,Y,Z inside matrix, compute inverse matrix and that it is.

[Notes]

Do not forget that FOV can have different angles for X and Y axis (aspect ratio).

Normal is just midpoint - Earth center which is (0,0,0) so normal is also the midpoint. Just normalize it to size 1.0.

For all computations use cartesian world GCS (global coordinate system).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!