Difference between Line-like Curve and Linear Curve

Hi guys,
what difference between them? I notice that my line-like Curve becomes linear curve after “extend curve” component (type line) and these linear curve after a “shatter” components gives both results (Line-like Curve and Linear Curve.
I would like to know if this difference could affect geometry or any operations afterwards.
Thank you in advance

2 Likes

I think they only differ in type and should only affect type things, but this is at a code level, GH already handles this for you, so there’s nothing to worry about.

By design, you can’t cast directly from Line to Curve (the same goes for Arc or Circle type), because they are value types (structures) rather than reference types (classes). So they cannot inherit GeometryBase, as the type Curve does, and that has many consequences, like for example if you have a function with input and output both of type curve, like for example exploiting a polycurve, you cannot return the type line or arc because it does not fit the type restriction of the function, they must be of type curve. One could convert these types to the Curve type, but it’s convenient to have a special curve with some specific line properties, and another curve type with arc properties, to bring the best of both together. Then you can return curves because the LineCurve or ArcCurve types inherit from the curve type. GH makes this difference by putting a different name on it, but in the practice of using GH, all of this is irrelevant.

3 Likes


lines.gh (13.7 KB)

From a fast check i can say:
both “Line-like Curve” and “Linear Curve” objects can still contain many control points!
So grasshopper is just telling you “the control points are aligned”, but in fact it still is a curve.
“Linear Curve” seems to be with degree=1, a straight polyline OR an interpolated straight curve.
“Line-like Curve” seems to be when degree>1, a straight nurbs curve.

A “Line” is an object that contains only 2 points (or even simpler, 2 set of XYZ values), so a much more simple object with no weight, no knots, no degree, etc…
See how after casting Curve to Line the control points are just 2 (start and end).

Note that some kangaroo goal objects (such as “Angle” component) works with pure “Line” objects, and not “Line-like” or “Linear”, remember to cast them into a “Line” parameter before using them.

If you need to work with pure “Line” and want to avoid possible errors from tolerances and such, just pick ends of your curve and build a new Line.

3 Likes

Thank you for all amply clear and detailed explanations
Thank you @Dani_Abalde and @maje90
:heart: :+1: :pray: