Grasshopper

algorithmic modeling for Rhino

Hi Everyone,

I'm doing a research on curves which I'm tracing from images imported into Rhino.

I would like to know if there is any way I could find the mathematical functions out of curves drawn in Rhino by using a Grasshopper script?

Thanks in Advance,

Matt

Views: 3740

### Replies to This Discussion

Could you please post an example of the images you want to use?

What do you mean by mathematical functions? What do you want to achieve?

Rhino supports different kind of definitions for curves (e.g. a circle, arc, rectangle, line, polyline), but most of them can be represented as a nurbs curve (ToNurbsCurve() method on any kind of curve).

The mathematical definition of nurbs curves is quite open an can be found in any geometry textbook.

https://en.wikipedia.org/wiki/Non-uniform_rational_B-spline

What I'm looking for is the exact curve's function of curves I draw in Rhino

For instance, I guess for a "S line" (photo attached) should be something like the following (whit numbers instead of a,b,c,d):

F(x)=y=a*X^3 - c*x^2+ bX + d

Thanks

Attachments:

Thanks,

I think this is interesting and useful for sure.

However, I would rather find a way to calculate the exact F(x)=y = ? of any curve I would draw in Rhino because my research will need to compare different kind of curves.

So, I would need the exact formula of each curve rather than the general formula ax 3 + by 2 + 2cxy + 2dx +2ey + f = 0.

Basically, the output of the script would be the above or similar function with numbers instead of the parameters (a, b, c, d, e).

It is not possible to represent any curve in Rhino as a one-dimensional polynomial. Nurbs curves are piece-wise curves where each piece is defined by three polynomials (one for x, one for y and one for z).

It is possible to fit a polynomial through a set of points, but there's absolutely no guarantee that the equation in between the points is anywhere near the original curve.

There do exist good polynomial fitting algorithms. MathNet has several.

The attached file uses those to create a polynomial of a specific degree which resembles the sampled points as best as possible over a chosen domain. Attachments:

Thank you very much,

I will test some of these and let you know.

Matt

David, I downloaded both files, and unblocked MathNet.Numerics.dll and kept it where I downloaded it in the C:/WINDOWS/DOWNLOADS folder, do I have to copy it somewhere? I am getting this error ok sorry, I just had to close and open rhino, that error is gone, however I am receiving a new error regarding the matrix Hi, i'm trying to find an equation of a curve i created from grasshopper.

I dowloaded your script, i closed and restarted rhino i also copied the .dll file in the libriaries grsshopper folder but it still says that it's not to be found.. were did i get it wrong ?

thank you for any help

I'm using Geogebra software to find the exact formulas of the curves. I find it quite useful because you can insert an image and draw the curve points on top of this image and then create the curve from the points. The curve formula appears immediately in the expression window.

by June Lee

• Add Photos
• View All

## Videos

• ### Grasshopper Weaverbird Tutorial (Sub D)

Added by Parametric House

• ### Origami Wall Pattern Facade Rhino Grasshopper Tutorial

Added by June Lee

• Add Videos
• View All

© 2021   Created by Scott Davidson.   Powered by