Tangent lines for bezier and catmull
When I am plotting a line (visualizes function $f(x)$ in cetz with bezier or catmull, I would like to add tangent lines for visualizing $f'(x)$ at different x positions of the line.
The tangent coordinate functionality that I tried using for this seems to not be intended for this usecase:
catmull(name: "line", ..points)
circle(name: "tangent_here", p, radius: 1mm, fill: white)
line("tangent_here", (element: "line", point: "tangent_here", solution: 0))
Which leads to the tangent lines not being perpendicular to the plot:
The goal is to produce something like this:
It would be nice to have some functionality to produce these tangent lines for arbitrary shapes (e.g. from catmull).
Proposal: Have a more verbose (tangent: <distance, ratio>, on: <element>, [length: number=1]) and (normal: <distance, ratio>, on: <element>, [length: number=1]) to get a point on the tangent or normal of a path. The current tangent implementation is not very useful.
Thanks, this looks like a good solution :+1: .
Could the value of tangent then also be a point (that has to be on the line)?
As I understand the proposal [tangent](tangent: <distance, ratio>) would be a scalar indicating the position on the line (e.g. 0-100%).
The point value for tangent would be useful when I have the exact x,y position where I want to insert the tangent/normal line.
I also think that the current functionality should be retained (along with the proposal), as it can be used as in the example from the manual with a circle.