Very fast 3D distance check?

后端 未结 13 1892
南方客
南方客 2021-01-31 15:40

Is there a way to do a quick and dirty 3D distance check where the results are rough, but it is very very fast? I need to do depth sorting. I use STL sort like this

13条回答
  •  梦谈多话
    2021-01-31 16:29

    If you worry about performance, you should also take care of the way you send your arguments:

    float Get3dDistance( Vec3 c1, Vec3 c2 );
    

    implies two copies of Vec3 structure. Use references instead:

    float Get3dDistance( Vec3 const & c1, Vec3 const & c2 );
    

提交回复
热议问题