Bezier Curve Length in Processing

Kreg Steppe CC by-nc-sa 2.0

Kreg Steppe CC by-nc-sa 2.0

Measuring the length of curvy, bendy shapes like Bezier curves is notoriously hard in Processing (and most other languages!).

Processing gives us some helpful tools like the bezierPoint() function, but that works based on the curve’s parameterization of 0-1, not the actual length. There has been some talk of adding functions to the API, and for now there’s a good curve parameterization example under Topics/Curves in Processing.

Here’s a quick-and-dirty set of functions that work together to measure a Bezier curve in Processing, within a certain tolerance. Please see the comments for a more in-depth explanation of how it works, and where I got it from!

by 1 year ago

RESPOND

Your email address will not be published. Required fields are marked *