Pikchr

Bug Report: "Rotated" Arcs Are Cut Off by Bounding Box
Login

Bug Report: "Rotated" Arcs Are Cut Off by Bounding Box

(1) By anonymous on 2025-03-18 15:02:26 [source]

Hello,

"Rotated" arcs are cut off by the bounding box.

P0: dot at 0,0
P2: dot at 2,1
arc from P0 to P2 thin

Adding anything else (visible) to the diagram below the cutoff expands the bounding box resulting in the entire arc being visible.

P0: dot at 0,0
P2: dot at 2,1
arc from P0 to P2 thin
dot at 0,-0.25

This is an edge case and may not affect many people, but I figured it's worth reporting.

Thank you very much for your time and work on Pikchr.

(2) By spindrift on 2025-03-19 11:39:09 in reply to 1 [link] [source]

P0: dot at 0,0
P2: dot at 2,1
arc from P0 to P2 thin
margin = 0.2

It can also be ameliorated by increasing the margin parameter (and thus forcing the bounding box to be expanded).

This is obviously a work around rather than a solution.

I wonder how straightforward it will be to detect the extremes of coordinates needed for eg an arc.

A: [P0: dot at 0,0
    P1: dot at 2,1
    arc from P0 to P1 thin]

box color red at A width A.wid height A.height

It's definitely an issue with working out the bounding box for the object if it exceeds the endpoints in any direction.

(3) By drh on 2025-03-19 12:47:17 in reply to 2 [link] [source]

I do not have a precise algorithm for calculating the bounding box for an arc. The former method underestimates, leading to this bug. I have a new algorithm that overestimates slightly; see check-in 202503191241z. At least now it does not clip. It would be great if I had something better, though. I'll work on that...

(4) By drh on 2025-03-19 16:29:01 in reply to 3 [link] [source]

A more precise bounding box algorithm for arcs has now been implemented.