[OSM-dev] Algorithm help
SteveC
steve at asklater.com
Thu May 29 14:18:33 BST 2008
On 29 May 2008, at 13:17, Dave Stubbs wrote:
> On Thu, May 29, 2008 at 9:07 AM, SteveC <steve at asklater.com> wrote:
>> if the polygon is p1,p2,p3,p4...
>>
>> c = centre point of polygon
>>
>> v1 = the vector from c to p1 (p1 - c)
>> v2 = the vector from c to p2 (p2 - c)
>>
>> take the cross product of v1 and v2
>>
>> http://en.wikipedia.org/wiki/Cross_Product
>>
>> if its positive in the z axis its one way, if its negative its the
>> other
>>
>
> This only works for nice, simple polygons, of the type that are
> probably few and far between in OSM data. It'll work on roundabouts
> though which is my major use case for potlatch. The algorithm FAQ had
> a nice way using the cross product that will work for all polygons, by
> requiring some careful point selection.
oh any polygon where the center of mass is outside of the area
covered, gotcha
>
>
> Dave
>
Best
Steve
More information about the dev
mailing list