Good results! Too bad about Pufferfish, it’s not necessary. More than a “few lines of c# code” ![]()
Nice illustration of constrains and “givens”. Have you taken a look at the “Conics” in Rhino and used Symmetry and the “halflengh” instead of the fulllenght? With Conics you can fix the startpoint and the endpoint and select an “elbow-point” on the tangent. Then the curvature can be controlled with a Rho-value between 0 and 1. The lenght of a Conics can be calculated at any Rho-value, so it must be possible to do the reverse and calculate Rho using the lenght.
Thank you, this seems super promising! Do you think you could upload just the C# script? I’m getting a missing plugin error because I am still on Rhino 7.
Sure, here is Rh7 version
NURBS LENGTH CALCULATION_Rh7_RG2.gh (14.1 KB)
here’s a simple C# algorithm to get what you need. it’s usage is pretty self explanatory. it uses Newton’s method to continually refine the curve until the desired length is within tolerance OR the max number of iteration steps has been reached.
NurbsCurve_Deg3_StrTanTanEndLen_NewtonMethod.gh (11.1 KB)
Thank you @adel.albloushi and @RadovanG for the C# scripts! This solution took me from 75ms to 7ms to draw these curves.
FYI, I found a bug where my curve was getting flipped to the opposite of the end tangents. It’s a pretty easy fix, just made sure that the tangent was being multiplied by the absolute value of the factor math.
var p1 = p0 + (startTan * Math.Abs(factor * (1 - bias) * 2));
var p2 = p3 + (endTan * Math.Abs(factor * bias * 2));
