How to quickly "pick" a 2d element in large number of vector graphics elements, such as polylines, polygons, curves etc. In Qt, QGraphics can do this easily, but In my program, I don't need this class, I just need QPaint and QWidget.I want to manage and render these elements data myself. So.. Which related graphics knowledge I need to se开发者_如何学编程arch in google?, BSP-tree?R-tree?
Give me some advice, Thanks!
Seems that an R-tree is more designed for picking than a BSP-tree. According to the wikipedia article on Spatial Indexing, R-tree is
Typically the preferred method for indexing spatial data. Objects (shapes, lines and points) are grouped using the minimum bounding rectangle (MBR). Objects are added to an MBR within the index that will lead to the smallest increase in its size.
But are you sure it's worth your while to implement the creation, maintenance, and use of the R-tree rather than using QGraphics?
精彩评论