Using arcTo() for variable-radius corner-rounding

  • This is probably as much a trigonometry question as a Python/DB question, but here goes:

    I'm trying to generalize a method for rounding the corners of outlines I'm drawing around a heartline—I already have a solution for when the radius is 1/2 the outline thickness (or stroke width, if you like). I'm using arcTo() to draw the curve.


    In the diagram here, the control point for the arcTo() curve is D, defined by the nodes in the heartline path and the change in angle in that path (and constant for all rounding radii).

    Given node A, radius r1, and the negative angle A (in this case –45deg to keep the drawing easy), the target for the arcTo() curve, B1, would be defined (Ax + r1 * cos(angle A + 90), Ay + r1 * sin(angleA + 90)).

    So I would call arcTo(D, B1, r1) to get a curve that starts at E1 and ends at B1. So far, so good.

    But let's say I want the rounding to have the radius r2. How would I define B2 so that I could call arcTo(D, B2, r2), and the function will give me E2 as a starting point? How I get Ax – length(A → C2), Ay + length(C2 → B2)?

Log in to reply