Count points in a rectangle

前端 未结 9 1473
失恋的感觉
失恋的感觉 2020-12-29 23:53

I have lots (billions) of points in 2D which I can preprocess and I would like to answer queries which are of the following form:

Given all four corners of a rectang

9条回答
  •  南方客
    南方客 (楼主)
    2020-12-30 00:28

    Make triangle. Suppose, abcd is the rectangle and x is the point then if area(abx)+area(bcx)+area(cdx)+area(dax) equals area(abcd) then the point is inside it.

提交回复
热议问题