[OSM-dev] JOSM patch: align nodes in a circle
Robert Hart
Robert.Hart at BuroHappold.com
Sat Sep 16 01:53:42 BST 2006
Hi Matthew,
First off, great to see new contributors. A few very very very minor
points/questions...
1. You say "Please select at least two nodes", but of course your algorithm
does nothing with two points (as they must be equidistant from their own
average location).
2. Related to the first. With three points, there obviously *is* a circle
that passes through all three points, so you could argue that the nodes
shouldn't move. This also means your algorithm could behave unexpectedly on
any set of nodes that already lie on a circle, but that are not evenly
distributed around it. I doubt anybody would notice this ever.
3. Will this produce true circles at any latitude? (i haven't looked at how
JOSM handles coordinates/distances internally)
Rob
-----Original Message-----
From: dev-bounces at openstreetmap.org
To: Immanuel Scholz
Cc: dev at openstreetmap.org
Sent: 9/16/2006 1:27 AM
Subject: [OSM-dev] JOSM patch: align nodes in a circle
Hi,
I've put together a patch for JOSM that will align the selected nodes
onto a
circle. It is intended for careful use on roundabouts. Of course, not
all
roundabouts are circular, but the user has to determine if this feature
is
applicable :-).
The algorithm is quite straightforward:
1. find average position of selected nodes ("C")
2. find average distance from all selected nodes to "C"
3. move each node to average distance from "C", at same angle as
before
It does not move nodes around the circle, it just moves them on to it.
Therefore
it is reasonably safe from moving roads that join a roundabout.
This is very much a "firsts" e-mail. First patch to JOSM, first code
written in
Java, first post to the dev mailing list. Hope I'm doing things right
:-).
Can't upload the patch to the trac server as I get an Internal Server
Error when
I try and log in, so I've attached it to this e-mail.
Known issues:
* No icon; using the "clock" icon temporarily (it's round ;)).
* No translatons; sorry, I only speak English. Hope I've done the code
right.
* I might have done things in ways that can be improved on a lot!
* "Align Nodes in Circle" sounds a bit long-winded. "Circularise" is
shorter,
but not a real word as far as I know. Any suggestions?!
The patch was originally based on the reverse segments function.
Thanks!
--
Matthew
<<align-in-circle.patch>> <<ATT163737.txt>>
This message has been scanned for viruses by MailControl - www.mailcontrol.com
More information about the dev
mailing list