本文介绍了确定点是否在边界框内的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您如何确定某个点是否在边界框内?

我的观点是48.847172,2.386597。

'p>的BoundingBox:

  48.7998602295,
的48.8198640442,
的2.46138595581,
2.48138619423


解决方案



  if(bb.ix< = px& px< = bb.ax&& bb .iy< = py& py& py< = bb.ay){
//点位于边界框
}

bb 是边界框,(ix,iy)是它的左上角坐标,而(ax,ay)是它的右下角坐标。 p 是点,(x,y)的坐标。


How would you determine if a given point is within the bounding box?

My point is 48.847172 , 2.386597.

Boundingbox:

    "48.7998602295",
    "48.8198640442",
    "2.46138595581",
    "2.48138619423"
解决方案

Do just as usual:

if( bb.ix <= p.x && p.x <= bb.ax && bb.iy <= p.y && p.y <= bb.ay ) {
    // Point is in bounding box
}

bb is the bounding box, (ix,iy) are its top-left coordinates, and (ax,ay) its bottom-right coordinates. p is the point and (x,y) its coordinates.

这篇关于确定点是否在边界框内的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 04:49