Very fast 3D distance check?

后端 未结 13 1872
南方客
南方客 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:23

    How often are the input vectors updated and how often are they sorted? Depending on your design, it might be quite efficient to extend the "Vec3" class with a pre-calculated distance and sort on that instead. Especially relevant if your implementation allows you to use vectorized operations.

    Other than that, see the flipcode.com article on approximating distance functions for a discussion on yet another approach.

提交回复
热议问题