-1

Looking for an algorithm and or example implementation for curve made out of arcs with control points on that curve. There are algorithms for approximation of bezier curves with arcs, but technically I don't want to do any approximation, but rather some simpler (and faster to compute) solution that will use arcs (center point, start and end angle as input params).

Researched internet, did some experiments, but no satisfactionary results

  • 2
    Hi. The question is very vague and unlikely to be answered as it stands. Could you perhaps add a drawing of such a curve? An image is worth a thousand words! – Stef Feb 11 '23 at 12:56
  • 3
    Why do you think arcs are faster to compute than Bézier curves? – M Oehm Feb 11 '23 at 14:19
  • "I don't want to do any approximation": but you will be doing an approximation of the underlying curve anyway ! –  Feb 11 '23 at 19:40
  • 1
    @MOehm I guess I wasn't specific enough, what I meant when saying "performance" was performance of computing arguments for arc, not overall performance – user3924684 Feb 11 '23 at 23:07

2 Answers2

4

If you want to interpolate between two points and their tangents, you generally need to use 2 arcs. The resulting curve is called a "biarc", and biarc interpolation is reasonably common.

I recently made a program for calculating gear shapes (source, live), that uses biarc approximations. The part that determines the arcs from endpoints and tangents is here.

This version only works when the two endpoints and their tangents form a triangle. It puts the connection between the two arcs at the triangle incenter, which makes the tangent at the connection point parallel to the line between the two control points.

You can find a pretty extensive explanation of biarc interpolation at this site.

Matt Timmermans
  • 53,709
  • 3
  • 46
  • 87
  • Thank you, that is very helpful! My goal was to avoid anything else than control points (which mean no tangents) and achieved that in one of my experiments by creating one arc with 3 control points, and then creating remaining arcs based on destination point and tangent from previous arc. It works, but is a bit counterintuitive. – user3924684 Feb 11 '23 at 23:25
  • 1
    Methods used for picking tangents for spline interpolation, like Catmull-Rom, can also be used for biarc interpolation: https://en.wikipedia.org/wiki/Centripetal_Catmull%E2%80%93Rom_spline – Matt Timmermans Feb 11 '23 at 23:58
0

A circular arc is uniquely defined by two endpoints and one intermediate point. (The center is found by intersecting two bisectors.)

You can define a curve as a sequence of arcs having a common endpoint two by two. This achieves G0 continuity.

A circular arc is also uniquely defined by two endpoints and the direction of the tangent at an endpoint.

You can obtain G1 continuity by choosing the direction at the first endpoint and propagating it to the next arcs. There remains one degree of freedom.