Grasshopper

algorithmic modeling for Rhino

hi , all. What is the significance of converting a curve to nurbs curve with the curve method tonurbscurve ?  thanks.

Views: 2503

Replies to This Discussion

Rhino.Geometry.Curve is to be treated as an abstract class. There are lots of different kinds of curves but they are all derived from the Curve base class. NurbsCurve is only one of these.

The special thing about NurbsCurve is that it can represent every other type of curve to within maximum accuracy. Circles and Arcs can be converted to degree=2 nurbs curves with weighted control points. Lines and Polylines can be converted into degree=1 nurbs curves. Polycurves can be converted into arbitrary nurbs curves with multiple interior knots for kinks. This is why all curve types support conversion to Nurbs curves.

The benefit from the developer point of view is that when your algorithms work on nurbs curves, they can work on all curves. If you rely on control-points or spans, then you can always get those via the ToNurbsCurve() method.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

get it .thanks a lot David!

But David, is it the truth that only line has the length property?How about curves or nurbs curves?

Rhino.Geometry.Line is not a type of curve. As in; it doesn't derive from Rhino.Geometry.Curve. There is another type called LineCurve which does derive from Curve and which provides a wrapper around the Line structure.

Curve have a method called GetLength() which has several overloads. It allows you to both get the length of the whole curve, or a sub-curve.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service