Opened 12 years ago

Closed 10 years ago

[patch] Align nodes in circle results are unstable

Reported by: Owned by: alv team normal 14.03 Core tested align node circle

Description

Steps to reproduce:

• select any 3+ node way or enough nodes
• hit O to align nodes in circle; shape is changed
• hit O again to align nodes in circle: shape is changed again

What is the expected result:

• second align nodes in circle should not move anything, because the nodes were just (should have been, anyway) already aligned in a circle.

comment:1 by skyper, 12 years ago

Priority: minor → normal

I have a real nice example where this action does not work at all

example file

comment:2 by Balaitous, 10 years ago

Problem is that center is computed as centroid of nodes.
Even if nodes are already aligned in circle, centroid may differ from center.
I propose a last square method based on bisector.

I will put an update of the patch after ticket #8431 will be done.

comment:3 by Balaitous, 10 years ago

Summary: Align nodes in circle results are unstable → [patch working] Align nodes in circle results are unstable

comment:5 by Balaitous, 10 years ago

Summary: [patch working] Align nodes in circle results are unstable → [patch] Align nodes in circle results are unstable

Patch is now OK (and I wish without bugs !!)
I use a least square method to compute center of circle, that ensure exact computation of center if nodes are already align in circle.

since r6920

comment:6 by Don-vip, 10 years ago

Milestone: → 14.03

Good, but some remarks before committing:

• I'd prefer a new method in Geometry class, with a clear distinction about the difference between getCentroid and getCenter
• Can you rephrase the displayed error message to be more user friendly? Something about the number of required nodes for example.

since r6933

comment:7 by Balaitous, 10 years ago

I have put a new version. getCenter is now in Geometry class.

There remain a bug: result can be strange if you apply AlignInCircle action over a self crossing way.
But it is not a normal "use case", so I don't know if this bug is blocking.

In normal case, it is an improvement, since result is stable if you apply this action twice, and over an arc, the center is at the right place.

comment:8 by Don-vip, 10 years ago

Resolution: → fixed new → closed

In 6934/josm:

fix #7423 - Align nodes in circle results are unstable (patch by Balaitous)

thanks!

Modify Ticket

Change Properties