Centroid for odd stars is wrong
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 |
tags: | added: transformations |
Changed in inkscape: | |
status: | Fix Committed → Fix Released |
confirmed, the centre of the star moves as the star is rotated