Pikchr

Narrow box widths - rounding problems?
Login

Narrow box widths - rounding problems?

(1) By Ivan (aitap0) on 2022-12-07 08:56:40 [source]

Hello and thanks for Pikchr! It's like SolveSpace for technical documentation drawings.

I've stumbled upon a weird problem recently:

[
        stickwidth=.045
        box height 1 width stickwidth fill 0xC89DC7
        move width stickwidth
        box height 1 width stickwidth fill 0x9FAAD2
        move width stickwidth
        box height 1 width stickwidth fill 0x72B6C0
        move width stickwidth
        box height 1 width stickwidth fill 0x77B89D
        move width stickwidth
        box height 1 width stickwidth fill 0xA0B280
        move width stickwidth
        box height 1 width stickwidth fill 0xC5A685
        move width stickwidth
        box height 1 width stickwidth fill 0xD59CA7
]

My intent is to have a bunch of narrow boxes of the same width. Am I doing this right?

It may be hard to notice, but the two rightmost boxes are wider than the rest of them. At least Inkscape says the wider ones are 0.095 in wide and the narrower ones are 0.085 in wide, which seems to correspond to a difference of 1 in the CSS virtual pixel coordinate system. I haven't had the time for a deep look yet, but I think that Pikchr rounds the pixel coordinates in the <path> elements. There's probably a good reason for that.

How do I draw a number of narrow boxes without causing rounding problems?

(2) By drh on 2022-12-07 13:45:46 in reply to 1 [link] [source]

Should be fixed now in the latest check-in of Pikchr. The newest Pikchr has now also been added to the Fossil build, so you can see that the lines in the original problem description above now all appear to be the same width.

(3) By Ivan (aitap0) on 2022-12-07 19:13:46 in reply to 2 [link] [source]

Thank you for the quick fix!