revarbat / BOSL

The Belfry OpenScad Library - A library of tools, shapes, and helpers to make OpenScad easier to use.
https://github.com/revarbat/BOSL/wiki
BSD 2-Clause "Simplified" License
557 stars 62 forks source link

Calculate tangent to bezier curve at a point #74

Closed nickcoutsos closed 3 years ago

nickcoutsos commented 4 years ago

I added a function to calculate the tangent vector at a given distance along a given bezier curve. It's based on the bez_point function but stops recursing at the second degree and returns the difference between the two points.

Output from example usage:

Screen Shot 2020-10-05 at 10 10 01 PM

Ultimately I'd like to have a function that returns a transformation matrix that can be applied to a point traveling along the curve, but I'm not sure if I'd inadvertently be reproducing existing functionality like extrude_bezier_along_bezier.