开发者

Hashing, polygonal shapes relative to to x,y location

I am trying to build a polygonal shape tool and have it calculate against its area to find if a point exists inside or out side the area.

These examples work well you you want to calculate on every object every time, but I am looking for a way to "HASH" the shape/area of a polygon relative to a spacial location, then The math becomes a simple "HASH" check to find if a value exists inside or outside of the defined "HASH".

I have found some decent basic examples:

http://jsfromhell.com/math/is-point-in-poly ,开发者_开发知识库

http://en.wikipedia.org/wiki/Point_in_polygon (Ray casting algorithm)


http://en.wikipedia.org/wiki/Geometric_hashing

I think this explains everything nicely.

Given that it can really only be used to determine if two objects are similar (given that the difference is a simple set of transformations), it can be shown that actual spatial information is lost.

Therefore the answer to your question is no.

To my knowledge you can't use a geometrical hash to determine if a point is in a shape.


I think the question could use a bit of clarification, but for some applications, a simple bounding box per polygon can help you eliminate some of the polygons quickly before you go into the exact calculations.


You may build a tree to structurize your polygons or create a grid where you can store lists of polygons which intersect cells. It depends on your problem size and specific stuff. The main idea is to operate only with polygons that is near the point.

If you are dealing with Manhattan geometry, then you can consider using Interval tree,

see wikipedia: http://en.wikipedia.org/wiki/Interval_tree

and a good book for the details:

Mark de Berg, Marc van Kreveld, Mark Overmars, and Otfried Schwarzkopf. Computational Geometry, Second Revised Edition. Springer-Verlag 2000. Section 10.1: Interval Trees, pp. 212–217.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜