Stroke width rounding errors
Merged from https://bugs.launchpad.net/inkscape/+bug/168002
inkscape version: 0.44.1, built Sep 7 2006
Stroke width gets modified slightly when changing an object even with "Scale stroke width" unchecked, resulting in creeping rounding errors.
To demonstrate: Create simple rectangle with "Snap bounding boxes to grid" set, grid = 1px, set stroke width to 1 and save:
<rect
id="rect3268"
style="opacity:1;fill:none;fill-opacity:1;stroke:#5800e9;stroke-width:1;str
oke-linecap:butt;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffse
t:0;stroke-opacity:1"
y="10.499965"
x="10.500224"
height="478.99966"
width="479.00003" />
This is correct. Then reshape rectangle (stretch one side for example) and save again:
<rect
id="rect3268"
style="opacity:1;fill:none;fill-opacity:1;stroke:#5800e9;stroke-width:0.999
99988;stroke-linecap:butt;stroke-miterlimit:4;stroke-dasharray:none;stroke-
dashoffset:0;stroke-opacity:1"
y="10.499965"
x="10.500221"
height="478.99966"
width="488.99963" />
Now stroke-width is 0.99999988, although this is displayed as "1.000" in the stroke style dialog.
This has a knock-on effect on the x/y/width/height values, resulting in imprecise values (478.99966,488.99963 instead of 479/489)
su_v (suv-lp) wrote on 2010-06-29:
try increasing the precision as suggested above and see if this is still reproducible?
Inkscape 0.47+devel r9542 on OS X 10.5.8
- rectangle with no fill, stroke-width 10px
- grid spacing 1px, snap to visible lines, zoom 100%
- tested with both visual and geometric bbox mode
- tested with both snap bbox corners or snap nodes to grid
- verified by watching live updates in the XML Editor
Precision 8 (default): reproduced - sometimes the stroke width gets modified slightly, most of the times the x/y and/or height/width parameters of the rectangle have rounding errors, not displayed in the select controls bar fields.
Precision 16: still reproducible but not consistently: randomly and rarely seen rounding errors of the stroke width, >mostly when dragging the left bounding box edge (de-/increasing the width of the rectangle). The x, y, width and height >parameters show no rounding errors when precision is raised to 16.
Possibly related to bug #190557 in Inkscape: “resize of object or group by entering a numeric size results in a >different size.”? (still reproducible in current 0.47+devel builds, shows varying rounding errors of shape position and dimension however >rarely affects stroke-width attribute)