Getting the bounding box of a vector of points?

前端 未结 3 822
遥遥无期
遥遥无期 2020-12-31 15:31

I have a vector of points stored in a std::vector instance. I want to calculate the bounding box of these points. I\'ve tried with this code:

bo         


        
3条回答
  •  無奈伤痛
    2020-12-31 15:41

    Simply iterate over all elements and keep track of the current min/max. You can use boost::minmax to update both at the same time. Really no need to iterate twice over your dataset.

提交回复
热议问题