0
$\begingroup$

I have an algorithm to automatically generate control points for smooth Bezier curves which pass through given nodes. It's inspired by what Inkscape appears to do when you make nodes "auto-smooth". In a nutshell:

  • A node's control points lie in a straight line through the node
  • That line is parallel to the line drawn between the node's two neighbors
  • The distance of the control points from the node is proportional to the distance from that node to its neighbors

That produces Bézier curves like the below edited screenshot of Inkscape. But how do I minimize the number of inflection points?

Bezier

Some commentary on this image:

  • The thick black line is the Bézier curve
  • There are five nodes
  • Thin blue lines are drawn from each node to its control points
  • A thin green line is drawn between nodes #2 and #4. This illustrates that the third node's control points lie on a parallel line per the described algorithm
  • Red arrows are drawn where the Bézier looks wiggly
  • I've circled where I estimate a couple of inflection points to be
  • A thin purple line marks where the third node's control points could be located to reduce the number of inflection points

The wiggliness of this arrangement of nodes is what caught my eye. Other than this arrangement of nodes this algorithm produces curves that look okay.

Intuitively I understand that mirroring the third node's control points across the Bézier curve will eliminate the inflection points I circled. An analogous solution that I think would work in general would be to minimize the control points' distance from the resulting Bézier curve while keeping them in a straight line. But I don't know how to formalize these intuitions.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.