Natural Curve Extension Bug

Hi there, I just got some issues when using the Rhi7’s curve extension function.

When I extend the curve by ‘natural’ method to the boundary, the curve unnaturally looping around as shown in the image:

BEFORE>

AFTER>

I have checked the Rhino’s API:
https://developer.rhino3d.com/api/rhinocommon/rhino.geometry.curveextensionstyle

And I checked the BEFORE curve’s curvature, but am still not sure what leads to that result.

My expected result is like:

CrvExtend_Bug.3dm (39.6 KB)

It seems to be how the algorithm works, but do not know for sure as I have not seen the code.

(Somewhat esoteric explanation/speculation follows) It appears to me that for a degree 3 curve ExendCrv using the Natural option or Smooth option essentially does a linear extrapolation of the second derivative of x,y,z with respect to the parameter (note this is not the curvature), and then integrates the result twice for the final curve.

I think the code is the same as Extend command in Rhino, when u choose the type as Natural.
image

As for the py code, its like:

import Rhino.Geometry as rg

crv=crv

bnd=bnd

# extend crvs to bound

curve_end =rg.CurveEnd(3)

extension_style =rg.CurveExtensionStyle(2)

crv_ex=crv.Extend(curve_end,extension_style,[bnd])

I also attach the sample python gh file here~
1012_Extend_Sample.gh (3.7 KB)

Hi @wally98,

I’ve logged an issue so a developer can look into the issue.

https://mcneel.myjetbrains.com/youtrack/issue/RH-84316

– Dale

1 Like

Hey Dale,

Really thx for that.

One question, besides this McNeel Forum, what other places do Rhino users go for help if they bump into such technical issues (for instance, YouTrack) !
:face_with_monocle:

W

Hi @wally98,

Discourse is all I know of.

YouTrack is our issue tracking system; it’s not a place to go for help.

– Dale

Try rebuilding the curve - you can keep the same degree and point count. Then extent.

– Dale

The extension works pretty well after rebuilding. Thx Dale!

But is there any chance to detect such weird extension before I actually extend this curve, in program way?

Or to say, is there any chance/ hints to know a bit more of the technical principles of the Extension function, so that I could have a better control of it in the application!

The curve extension continues the curve with a piece that does what the curve is doing at the very end. If you look at the curvature graph in detail, you can see the curvature starts to increase right at the end. That’s what the extension will keep on doing too until the curve loops itself.

— Dale

1 Like