I would like to suggest improving blendcrv functionality. G2 to G2 blend creates curvature continuous transition but curvature along the transition line is far from perfect.

Lets demostrate a perfect blend on a line and tangential arc. G2 blend should produce transition curve where its curvature is varying linearly from 0 to finite curvature.

This can be considered a true blend. What we have now is only partially correct because the curvature within transition curve is rather arbitrary and does not match any emergent logic.

for 2d problem (planar) it is definitely solvable with unique solution because the transition is strictly defined as a clothoid curve. for 3d i believe there is infinite number of solutions so we need one more constraint or goal which is to make curve as short as possible keeping the other property.

@davidcockey could you please join the discussion its too much math for me but i sense it is possible to create perfect transition curve in 3d space which has linearly varying curvature

Note that a clothoid/Euler spiral with curvature varying linearly with length along the curve is different than an Archimedean spiral with distance from a center point. The Rhino command Spiral with Flat option creates a non-rational NURBS curve which approximates an Achimedean spiral.

An online search for Clothoid NURBS returns numerous publications on approximating Clothoids with a NURBS curve, but none on an exact representation of a clothoid by a NURBS curve. A clothoid is not a conic curve which makes me very skeptical that a clothoid can be represented exactly by a NURBS curve. The reference Juan provided the link does not include anything related to representation of a clothoid by a NURBS curve. (All NURBS curves are parametric curves but most parametric curves are not NURBS curves.)

OK one thing is if its possible to represent with nurbs curve. Other thing is if it is possible to calculate exact points on the curve and then just simple fit it with spline creating almost perfect curve.

My goal is this: Blend any 2 curves in 3d space so that transition curve matches ends curvatures and curvature along its length varies linearly and curves length is shortest possible. I believe there is some crazy math behind but the output should be bunch of points lying exactly or almost exactly on the theoretical transition curve which can be then connected via polyline or spline. My question is if this is possible. You seem to be very erudite about this

A clothoid/Euler curve can be represented to any desired accuracy by NURBS curve.

Except for very few special cases this is not possible due to how the the basic geometry works. For the planar case conditions to be satisfied are:
End 1: x and y position coordinates, tangent direction, curvature
End 2: x and y position coordinates, tangent direction, curvature

If the position, tangent direction and curvature at one end are specified, and the curvature at the other end is specified, then the length along the clothoid can be specified to match the tangent direction at the other end. However once the length along the clothoid is selected the coordinates of the second end are also specified. So it is not possible to satisfy all the conditions required for the blend curve.

I came across the problem of how to represent a clothoid with a minimum amount of CVâ€™s in a project for an engineering company planing railway tunnels.

Clothoid s are used in planing railway tracks and street s. The curves we had to handle in above project were approximated with polylines.

Attached the best I could get with single span degree 5 Curve.

The screenshot shows, that it s not that easy to use a singel clothoid for a given gab between 2 curves.
if you define

start point, tangent, curvature

end curvature

curve length

the curve is already defined.
But this also means endpoint and end-tangent are the result of above input conditions.

in other words - given 2 curve ends (position,tangent,curvature) - only very rare settings can be connect with a single clothoid.
(one solution in street/railway tracks is, to have a starting clothoid, an arc, a final clothoid between two linear parts)

great! i am actually a bridge designer working predominantly on railway projects. i am aware of what you are saying but its is new to me that it is not always possible to simply connect any two curves. i had thought it would always be possible in planar space.

do you hahe a python script for that or how did you actually achieve that?

So basically there are two reasonable ways how you can fully define the curve (clothoid):

A
position of endpoints
curvature of endpoints
tangency of endpoints
curve length is thus unknown and curve shape is the calculated output

B
position of one endpoint
curvature of endpoints
tangency of one endpoint
curve length is only input and other endpointÂ´s position and tangency is the calculated result, unknown prior

I understand your solution works with the B procedure. Do you think that A procedure is also possible to obtain just by changing what is unknown in your equations?

Position at one end point.
Curvature at both end points.
Tangency of both end points.

Curve length can then be determined based on the end point curvatures and the difference in end point tangent direction.
Shape and other end point is calculated based on the curve length.

not reading all details above â€¦ clothoids can be over-defined very easily.

given a start condition with the green arc. (position, tangent, radius/curvature)
and a target radius (blue arc)

the screenshot shows 3 solutions where the clothoid ends with same radius, but has different lengths.

I am not 100% sure - but i would claim, that if you stay with the start condition (green arc) and you define only the target point - there is only one solution - including a fixed tangent and radius (for less then a 180 degree turn of the clothoid)

maybe there is some better interactive webpage - the one i found quite fast is this