4

So I'm getting a little confused with radii in Inkscape. For quite a while I thought that this:

Path with manual radius

was the same as this:

Rectangle with radius

... But it turns out that overlaying them on top of one another reveals that they are different:

Comparison

(where the red is the rectangle and the blue is the path)

Further analysis reveals that (after converting the rectangle to a path) the handles are in weird locations:

Weird...

So my question is, is it possible to create accurate border radii without the use of the Rectangle tool (where the radius is the same in all angles)? Or must I always rely on it to give me truly accurate results? And also does anyone have an explanation as to why the handles are where they are?

3
  • I would have expected them to be 2px away from their anchors, not ~2.2px Commented May 27, 2014 at 10:44
  • Here: imgur.com/7GPwAaV? Anyway, it seems that its a lot more complex than it seems - whizkidtech.redprince.net/bezier/circle/kappa Commented May 27, 2014 at 11:50
  • well you can do the coefficient fit yourself but the length of the tangents can be approximated as being 1/3 of the distance between points away in tangent direction. Please note a bezier can not make a perfect circle, so its allways an approximation.
    – joojaa
    Commented May 27, 2014 at 16:15

1 Answer 1

2

Rounding error at low pixel rates

Especially when drawing in the low pixel range there always is a considerable rounding error which then will become visible.

In the example below I drawed a circle with 4 px radius (grey), a rectangle with 4 px radius reounded corners (black), and a rectancle where the rounded corners were manually made from circles with a 4 px radius (see workaround below).

Values were carefully adjusted from the toolbar to exactly be of a radius 4.000 px). Still, we can see that the rounded rectangle is not perfect:

enter image description here

Draw at higher pixel rates for precision

As soon as we start working at a higher pixel rate (below the red circle has a radius of 40 pixel), the rounded corner of the rectangle will match the exact radius of 40 pixel much better:

enter image description here

Workaround for low pixel rates

In case we need the higher precision at low pixel rate drawings we cannot use the predefined rounded rectangle tool. We may then have to build our shapes manually, e.g. from a base circle:

  1. Transform circle to Bezier path (Path > Object to Path):

    enter image description here

  2. Select all nodes to Break path at selected nodes enter image description here

  3. Select a segment and move it to the desired position.

    enter image description here

  4. Repeat for all segments.

  5. Select the open nodes to Join selected endnotes with new segment enter image description here

    enter image description here

  6. Repeat for the remainder open segments.

This will give better results at low pixel resolutions (see red line in first example above).

1
  • Not too sure its a rounding error - probably just incorrect handle placements on my part, as seen in the question. But the second part of your answer is useful. Commented May 29, 2014 at 12:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.