[josm-dev] Validator plugin WronglyOrderedWays false error
Martijn van Oosterhout
kleptog at gmail.com
Sun May 11 10:57:03 BST 2008
On Sun, May 11, 2008 at 9:58 AM, Roy Rankin <rrankin at ihug.com.au> wrote:
> I have done a rewrite of the code as follows:
>
> Determine the mean latitude of the closed way.
> Then add the deltas of longitude for each segment starting with
> a latitude greater than mean and subtract the deltas of longitude
> if the start is less than the mean latitude.
>
> The result should be positive for clockwise ways and negative
> for counter-clockwise ways.
You're almost there. You should just use the proper formula for the
area of a polygon:
for each node
area += x*deltay - y*deltax
Dont' need to calculte the mean, nor test anything for direction. And
100% relaible (for non-self-intersecting polygons anyway).
Have a nice day,
--
Martijn van Oosterhout <kleptog at gmail.com> http://svana.org/kleptog/
More information about the josm-dev
mailing list