Hello, and I am working on generating a path which will wind through a number of points. I have selected the Hermite Curve3 type, as it gives me the most correct rendition of the curve I am trying to create, but the programmatically setting the tangent lengths continues to be a problem. The points are tangent to circles which have been placed on a plane, and I would like some advice on how to correctly recreate the curvature of the circle they have been extracted from in the curve.
Please have a look at the following pg:
In the _createSplineSegment function (line 50) I have the center, radius, and tangent points available to interpolate the hermite tangents, but I have yet to come up with a formula which works across all cases. The distances between centers is non-uniform as are the angles between points.
Thanks for any help you might lend, and please let me know if I can offer any additional clarification,
I found an article describing how to calculate tangents using the deflection angle of the two points (here), but the retrieved value requires a scale factor which causes other issues.
The formula is essentially: radius * tan(deflection / 2)
Here is an updated playground, which includes the calculation of the intersection point and the formula above.
@carolhmj might be able to help here as she worked on some paths examples previously
Hey there! I don’t think the Simple Curves calculation is going to work exactly all the time, because the Hermite spline is cubic, not quadratic. I tried creating a simple interface to explore the effect of the tangent length on the curve between two points on a circle, and it can’t fit exactly:
Tangent to circle | Babylon.js Playground (babylonjs.com)
I think in your case, it might be better to calculate the points along the circles using trigonometric functions, and join them with the other sections.
Thanks for looking at this, and for a viable solution to my issue. As I have the center/tan/radius already it should be easy enough to derive a set of points which represent the chord between the two points. The curve segments are used to create points for a Path3d object, and I don’t think I will lose anything to the method.