Index: trunk/src/org/openstreetmap/josm/actions/AlignInCircleAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/AlignInCircleAction.java	(revision 13106)
+++ trunk/src/org/openstreetmap/josm/actions/AlignInCircleAction.java	(revision 13107)
@@ -21,4 +21,5 @@
 import org.openstreetmap.josm.command.SequenceCommand;
 import org.openstreetmap.josm.data.coor.EastNorth;
+import org.openstreetmap.josm.data.coor.PolarCoor;
 import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.Node;
@@ -52,59 +53,15 @@
     }
 
-    private static double distance(EastNorth n, EastNorth m) {
-        double easd, nord;
-        easd = n.east() - m.east();
-        nord = n.north() - m.north();
-        return Math.sqrt(easd * easd + nord * nord);
-    }
-
-    public static class PolarCoor {
-        private double radius;
-        private double angle;
-        private EastNorth origin = new EastNorth(0, 0);
-        private double azimuth;
-
-        PolarCoor(double radius, double angle) {
-            this(radius, angle, new EastNorth(0, 0), 0);
-        }
-
-        PolarCoor(double radius, double angle, EastNorth origin, double azimuth) {
-            this.radius = radius;
-            this.angle = angle;
-            this.origin = origin;
-            this.azimuth = azimuth;
-        }
-
-        PolarCoor(EastNorth en) {
-            this(en, new EastNorth(0, 0), 0);
-        }
-
-        PolarCoor(EastNorth en, EastNorth origin, double azimuth) {
-            radius = distance(en, origin);
-            angle = Math.atan2(en.north() - origin.north(), en.east() - origin.east());
-            this.origin = origin;
-            this.azimuth = azimuth;
-        }
-
-        /**
-         * Converts this {@code PolarCoor} to an {@link EastNorth} instance.
-         * @return a new {@code EastNorth} instance
-         */
-        public EastNorth toEastNorth() {
-            return new EastNorth(radius * Math.cos(angle - azimuth) + origin.east(), radius * Math.sin(angle - azimuth)
-                    + origin.north());
-        }
-
-        /**
-         * Create a MoveCommand to move a node to this PolarCoor.
-         * @param n Node to move
-         * @return new MoveCommand
-         */
-        public MoveCommand createMoveCommand(Node n) {
-            EastNorth en = toEastNorth();
-            return new MoveCommand(n, en.east() - n.getEastNorth().east(), en.north() - n.getEastNorth().north());
-        }
-    }
-
+    /**
+     * Create a {@link MoveCommand} to move a node to a PolarCoor.
+     * @param n Node to move
+     * @param coor polar coordinate where to move the node
+     * @return new MoveCommand
+     * @since 13107
+     */
+    public static MoveCommand createMoveCommand(Node n, PolarCoor coor) {
+        EastNorth en = coor.toEastNorth();
+        return new MoveCommand(n, en.east() - n.getEastNorth().east(), en.north() - n.getEastNorth().north());
+    }
 
     /**
@@ -188,5 +145,5 @@
             } else if (outside.size() == 1 && inside.size() == 1) {
                 center = outside.get(0).getEastNorth();
-                radius = distance(center, inside.get(0).getEastNorth());
+                radius = center.distance(inside.get(0).getEastNorth());
             } else if (inside.size() == 2 && outside.isEmpty()) {
                 // 2 nodes inside, define diameter
@@ -194,5 +151,5 @@
                 EastNorth en1 = inside.get(1).getEastNorth();
                 center = new EastNorth((en0.east() + en1.east()) / 2, (en0.north() + en1.north()) / 2);
-                radius = distance(en0, en1) / 2;
+                radius = en0.distance(en1) / 2;
             }
 
@@ -239,5 +196,5 @@
         if (radius == 0) {
             for (Node n : nodes) {
-                radius += distance(center, n.getEastNorth());
+                radius += center.distance(n.getEastNorth());
             }
             radius = radius / nodes.size();
@@ -265,7 +222,6 @@
             }
             Node first = nodes.get(i % nodeCount);
-            PolarCoor pcFirst = new PolarCoor(first.getEastNorth(), center, 0);
-            pcFirst.radius = radius;
-            cmds.add(pcFirst.createMoveCommand(first));
+            PolarCoor pcFirst = new PolarCoor(radius, PolarCoor.computeAngle(first.getEastNorth(), center), center);
+            cmds.add(createMoveCommand(first, pcFirst));
             if (j > i + 1) {
                 double delta;
@@ -273,5 +229,5 @@
                     delta = 2 * Math.PI / nodeCount;
                 } else {
-                    PolarCoor pcLast = new PolarCoor(nodes.get(j % nodeCount).getEastNorth(), center, 0);
+                    PolarCoor pcLast = new PolarCoor(nodes.get(j % nodeCount).getEastNorth(), center);
                     delta = pcLast.angle - pcFirst.angle;
                     if (delta < 0) // Assume each PolarCoor.angle is in range ]-pi; pi]
@@ -280,6 +236,6 @@
                 }
                 for (int k = i+1; k < j; k++) {
-                    PolarCoor p = new PolarCoor(radius, pcFirst.angle + (k-i)*delta, center, 0);
-                    cmds.add(p.createMoveCommand(nodes.get(k % nodeCount)));
+                    PolarCoor p = new PolarCoor(radius, pcFirst.angle + (k-i)*delta, center);
+                    cmds.add(createMoveCommand(nodes.get(k % nodeCount), p));
                 }
             }
Index: trunk/src/org/openstreetmap/josm/actions/AlignInLineAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/AlignInLineAction.java	(revision 13106)
+++ trunk/src/org/openstreetmap/josm/actions/AlignInLineAction.java	(revision 13107)
@@ -21,4 +21,5 @@
 import org.openstreetmap.josm.command.SequenceCommand;
 import org.openstreetmap.josm.data.coor.EastNorth;
+import org.openstreetmap.josm.data.coor.PolarCoor;
 import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.Node;
@@ -308,6 +309,5 @@
                 double[] angle = new double[4];
                 for (int i = 0; i < 4; i++) {
-                    EastNorth p = neighbors.get(i).getEastNorth();
-                    angle[i] = Math.atan2(p.north() - c.north(), p.east() - c.east());
+                    angle[i] = PolarCoor.computeAngle(neighbors.get(i).getEastNorth(), c);
                 }
                 double[] deltaAngle = new double[3];
Index: trunk/src/org/openstreetmap/josm/actions/CreateCircleAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/CreateCircleAction.java	(revision 13106)
+++ trunk/src/org/openstreetmap/josm/actions/CreateCircleAction.java	(revision 13107)
@@ -25,4 +25,5 @@
 import org.openstreetmap.josm.data.coor.EastNorth;
 import org.openstreetmap.josm.data.coor.LatLon;
+import org.openstreetmap.josm.data.coor.PolarCoor;
 import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.Node;
@@ -108,6 +109,5 @@
 
         PolarNode(EastNorth center, Node n) {
-            EastNorth pt = n.getEastNorth();
-            this.a = Math.atan2(pt.north() - center.north(), pt.east() - center.east());
+            this.a = PolarCoor.computeAngle(n.getEastNorth(), center);
             this.node = n;
         }
Index: trunk/src/org/openstreetmap/josm/actions/OrthogonalizeAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/OrthogonalizeAction.java	(revision 13106)
+++ trunk/src/org/openstreetmap/josm/actions/OrthogonalizeAction.java	(revision 13107)
@@ -26,4 +26,5 @@
 import org.openstreetmap.josm.command.SequenceCommand;
 import org.openstreetmap.josm.data.coor.EastNorth;
+import org.openstreetmap.josm.data.coor.PolarCoor;
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
@@ -575,5 +576,5 @@
 
         public static double polar(EastNorth en1, EastNorth en2) {
-            return Math.atan2(en2.north() - en1.north(), en2.east() - en1.east());
+            return PolarCoor.computeAngle(en2, en1);
         }
     }
Index: trunk/src/org/openstreetmap/josm/data/coor/Coordinate.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/coor/Coordinate.java	(revision 13106)
+++ trunk/src/org/openstreetmap/josm/data/coor/Coordinate.java	(revision 13107)
@@ -117,5 +117,5 @@
         Coordinate that = (Coordinate) obj;
         return Double.compare(that.x, x) == 0 &&
-                Double.compare(that.y, y) == 0;
+               Double.compare(that.y, y) == 0;
     }
 }
Index: trunk/src/org/openstreetmap/josm/data/coor/PolarCoor.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/coor/PolarCoor.java	(revision 13107)
+++ trunk/src/org/openstreetmap/josm/data/coor/PolarCoor.java	(revision 13107)
@@ -0,0 +1,107 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.data.coor;
+
+import java.io.Serializable;
+import java.util.Objects;
+
+/**
+ * Polar coordinate.
+ * @since 13107 (extracted from {@code AlignInCircleAction})
+ */
+public class PolarCoor implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * Radial coordinate (distance from the pole).
+     */
+    public final double radius;
+
+    /**
+     * Angular coordinate in radians.
+     */
+    public final double angle;
+
+    /**
+     * Reference point (analogous to the origin of a Cartesian coordinate system).
+     */
+    public final EastNorth pole;
+
+    /**
+     * Constructs a new {@code PolarCoor}, using {@code (0,0)} as pole.
+     * @param radius radial coordinate (distance from the pole)
+     * @param angle angular coordinate in radians
+     */
+    public PolarCoor(double radius, double angle) {
+        this(radius, angle, new EastNorth(0, 0));
+    }
+
+    /**
+     * Constructs a new {@code PolarCoor}.
+     * @param radius radial coordinate (distance from the pole)
+     * @param angle angular coordinate in radians
+     * @param pole reference point (analogous to the origin of a Cartesian coordinate system)
+     */
+    public PolarCoor(double radius, double angle, EastNorth pole) {
+        this.radius = radius;
+        this.angle = angle;
+        this.pole = pole;
+    }
+
+    /**
+     * Constructs a new {@code PolarCoor} from an {@link EastNorth}, using {@code (0,0)} as pole.
+     * @param en east/north coordinates
+     */
+    public PolarCoor(EastNorth en) {
+        this(en, new EastNorth(0, 0));
+    }
+
+    /**
+     * Constructs a new {@code PolarCoor}.
+     * @param en east/north coordinates
+     * @param pole reference point (analogous to the origin of a Cartesian coordinate system)
+     */
+    public PolarCoor(EastNorth en, EastNorth pole) {
+        this(en.distance(pole), computeAngle(en, pole), pole);
+    }
+
+    /**
+     * Compute polar angle between an east/north and the pole.
+     * @param en east/north coordinates
+     * @param pole reference point (analogous to the origin of a Cartesian coordinate system)
+     * @return polar angle in radians
+     */
+    public static double computeAngle(EastNorth en, EastNorth pole) {
+        return Math.atan2(en.north() - pole.north(), en.east() - pole.east());
+    }
+
+    /**
+     * Converts this {@code PolarCoor} to an {@link EastNorth} instance.
+     * @return a new {@code EastNorth} instance
+     */
+    public EastNorth toEastNorth() {
+        return new EastNorth(
+                radius * Math.cos(angle) + pole.east(),
+                radius * Math.sin(angle) + pole.north());
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(radius, angle, pole);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) return true;
+        if (obj == null || getClass() != obj.getClass()) return false;
+        PolarCoor that = (PolarCoor) obj;
+        return Double.compare(that.radius, radius) == 0 &&
+               Double.compare(that.angle, angle) == 0 &&
+               Objects.equals(that.pole, pole);
+    }
+
+    @Override
+    public String toString() {
+        return "PolarCoor [radius=" + radius + ", angle=" + angle + ", pole=" + pole + ']';
+    }
+}
