Rotate shape adds node

Bug #515237 reported by Lawrence on 2010-01-31
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Inkscape
Undecided
Krzysztof Kosinski

Bug Description

hi,
Rotating a relatively simple shape by 120 degrees adds a node to the path. The shape is a kind of like the letter V. The original has six nodes but when rotated 120 degrees another node gets added resulting in seven nodes. Rotating by 90 or 135 does not add a new node. This problem occurred by selecting the shape, clicking on it again which shows the rotation arrows. Mouse down on a corner rotation arrow and move the mouse to rotate the object, release the mouse button when 120 degree and a node will be added. This happens both when the constrained rotate, that is when the ctrl key is held down, and in the normal non-constrained rotate. In the non-constrained rotate the rotation does not have to be exactly 120 degrees.

The extra node was causing me confusion because the new node is in the same position as another node so it is not easily visible.
Attached is a file showing the original shape and rotated duplicates.

Lawrence (annon0m0s) wrote :
Alvin Penner (apenner) wrote :

It looks as if the problem is caused by round-off error.
In the XML editor all four objects are identical, they all have a start point followed by 6 nodes, as expected. The difference is that three of them have relative coordinates that add up perfectly to zero, while the fourth one does not.
    Attached is a file with the calculation of the net movement of the final point relative to the initial point, which should be zero. In the third object there is an error of .00023 in the x-coordinate net movement which is enough to apparently make the parser think that the object is not closed, so it adds on an additional point.

Changed in inkscape:
status: New → Confirmed
Lawrence (annon0m0s) wrote :

I can sometimes reproduce the issue without using rotate by just using the arrow scale at the corner of the bounding box. I was concerned that the shape was small so a rounding error may happen on small shapes. By changing the toolbars control bar to show % size then changing a couple of times to 200% the shape was increased in size and there was still six nodes. That gave the same shape with six nodes but a larger size. The xml did not list any nodes using scientific notation "1e-4" style. With the larger shape the scale arrow was used and sometimes the status bar would list the shape as having seven nodes.

The original issue is also reproducible when the rotation is clockwise. The original rotation was counter clockwise. I was not able to reproduce this issue using a rectangle or a star with 20 points converted to paths. Could the issue have something to do with the shape itself? At one of the points the path goes, I'm not sure this is the correct wording, concave. If that point is deleted the status bar indicates the shape still has six nodes (one removed but the end point added.)

Alvin Penner (apenner) wrote :

attached is an example of the same problem occurring with a star shape. The second star is an exact copy of the first star. I just copied it and then rotated it randomly until the 10 nodes turned into 11 nodes. You can tell which node is going to break apart when you edit it, because the rectangle for it is a bit smaller than the other rectangles when using the node editor. The star that still has 10 nodes will not break apart when you edit it.

Alvin Penner (apenner) wrote :
~suv (suv-lp) on 2010-02-01
tags: added: transformations
~suv (suv-lp) wrote :

Could this be a bug in 2geom? similar to
Bug #262064 “rectangles sometimes turn into pentagons upon editing”
Bug #257289 “Object to path, refocus - extra nodes generated”

Lawrence (annon0m0s) wrote :

It does seem similar to bug #257289 2geom calculating the closing segment of a path.

Alvin Penner (apenner) wrote :

attached is an example of a rectangle which showed the same problem. I copied it and then rotated it a number of times to produce 5 nodes instead of 4. So far, I can produce this behaviour _only_ on rotation, and _only_ when one of the sides is perfectly vertical or horizontal after rotating.

Krzysztof Kosinski (tweenk) wrote :

I recall there was a bug in HLineSegment / VLineSegment that I fixed some time ago in the 2geom tree that could cause this behavior.

Changed in inkscape:
assignee: nobody → Krzysztof Kosinski (tweenk)
Krzysztof Kosinski (tweenk) wrote :

Fixed in r9062 and lib2geom r2041. It turned out that the bug was in path.cpp, and the thing I fixed before was unrelated.

Changed in inkscape:
status: Confirmed → Fix Committed
Krzysztof Kosinski (tweenk) wrote :

My fix introduces a much more serious bug: when a path has non-degenerate closing segment, it is ignored. No idea how to fix this at the moment.

Changed in inkscape:
status: Fix Committed → In Progress
Krzysztof Kosinski (tweenk) wrote :

I think this bug is caused by a loss of precision when transforming paths with relative coordinates. The extra node appears because the last segment in SVG data (z) is almost zero length. When the path is rotated, its length exceeds the threshold below which it is considered zero-length in the node tool, and so a new node appears. This could be solved by always using absolute coordinates for the last segment.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers