Polynomial Regression



I have freeform curve. Is there a way to get the polynomial equation of the curve?
The only way I know is to export points to Excel and use a graph and trendline to get the equation…
Maybe there is a way in Rhino

Best regards,

(Menno Deij - van Rijswijk) #2

The curves in Rhino are parameter curves. This means that there is a parameter t and the curve coordinates are described by function X(t), Y(t) and Z(t). This function is the NURBS function, where NURBS stands for non-uniform rational B-spline, where each coordinate (X, Y and Z) is a function of the location of the control points’ XYZ coordinates and some blending function (the spline).

This means that the more familiar Y as a function of X ‘Y(X)’ is not generally available for NURBS curves, because both X and Y are a function of t and not of each other.

For more information on NURBS, see https://en.wikipedia.org/wiki/Non-uniform_rational_B-spline


Ok thanks
Is it possible to get any equation or parameter that describes my curve?

(Menno Deij - van Rijswijk) #4

Most certainly. The NURBS curve is fully determined by the locations of the control points and the knot vector. Both can be obtained by selecting the curve and running the List command. This will show you developer/debugging information, including the knot vector and the control point (CV).
Then, you plug these numbers into the recursively defined B-Spline expression found on the Wikipedia page https://en.wikipedia.org/wiki/Non-uniform_rational_B-spline#Technical_specifications (scroll down, see knot vector, control points, basis functions and finally General form of NURBS curve.

Maybe the following is not necessary, but I want to give you a small warning:
If you don’t have experience with this, it may be difficult to wrap your head around the concepts. It will not be a simple Excel-style formula that you can fill in.

Ultimately though, the question is: what do you want to achieve?

(Vishalg2235) #5

@menno I have station coordinates(offset table) of a ship. It is of around 75m length and I want to get all station curve equation so that I can scale my ship from 60-100m length and corresponding breadth and depth. How can I get the NURBS equation of all the stations so I can scale them properly.
Following is the screenshot of the station curves.


I suppose the curves are planar.
You can divide the curves by points or length and these points can be exported as txt file. If you import this file into the any spreadsheet like Excel or Libreoffice Calc you can calculate the polynomial regression.