Centroid for odd stars is wrong

Bug #462157 reported by Ariel
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Low
Krzysztof Kosinski

Bug Description

The centroid for stars/polygons with odd number of sides is calculated wrong.

Replicate the bug:

1. Create a regulat 5 peak. Deliberatedly make it not having vertical symmetry (no peak pointing upwards/downwards).
2. Try to rotate it. It will rotate around a weird point (depends on creation angle).

Currently the centroid is calculated in a rather simplistic way using the bounding box. But a 5 peak star for example has a non square bounding box (depending on it's current rotation angle) even when it's symmetry is based on a circle.

Why is it a bug?

* The centroid of the created star/polygon will depend on the first bounding box, seems random at first sight.
* Rotation is broken
* Aligning wont work as expected
* Counterintuitive that a regular shape won't rotate around it's center.

Proposed Solution:
* Define the star/polygon bounding box as a square. Centered on the centroid. OR...
* Define the star/polygon centroid at the centroid (and update every time bb changes)

Temporal workaround

1. Create a regulat 5 star with vertical symmetry (a peak perfectly pointing up or down)
2. Clone it
3. Flip vertically the clone
4. Make the clone all transparent
5. Group it
6. The group will rotate as expected

Of course this will work for 7, 9, 11... stars but the bug becomes less apparent the more pikes the star has.

Related branches

tags: added: shape-editing
su_v (suv-lp)
tags: added: transformations
Revision history for this message
Alvin Penner (apenner) wrote :

confirmed, the centre of the star moves as the star is rotated

Changed in inkscape:
status: New → Confirmed
Revision history for this message
Ariel (ariel-zarzamora) wrote :

Any news on this?

Revision history for this message
Krzysztof Kosinski (tweenk) wrote :

Fixed in 9204.
When creating a star, its transform center is set to its true centroid rather than to the default midpoint of the bounding box.

Changed in inkscape:
importance: Undecided → Low
assignee: nobody → Krzysztof Kosinski (tweenk)
milestone: none → 0.48
status: Confirmed → Fix Committed
Revision history for this message
su_v (suv-lp) wrote :

Revision 9204 breaks rotational symmetries (P3, P31M, P3M1, P6 and P6M) in the 'Tiled Clones' dialog used with an odd-sided star/polygon shape (verified by testing r9157 [ok] and r9214 [incorrect transfromation]) - see bug #579617 comments #9-14.

Additional inconsistencies after the changes of r9204:
- when changing the number of corners of a polygon form even to odd (e.g. from 4 to 3), the correct transformation center is not added
- when changing the number of corners of a polygon from odd to even (e.. from 3 to 4), the transformation center is not auto-updated (i.e. incorrect for the resulting 4-sided shape)

jazzynico (jazzynico)
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.