Reset a curve domain in Rhinoscript?


#1

Dear members,

I am dealing with a closed curve in Rhinoscript that is trimmed to an open curve.

The curve is oriented that it goes from smaller values to larger values, but now the start point has a large negative number in the curve domain (-160) and the end point a curve parameter near zero (-2).

I would like to keep going from small to large but reparametrize the curve that the start point has value 0 and the end point a value like +160. How can I do this?

Kind regards,

Filip


#2

Hi Filip,

There’s no rhinoscript function which does this. But it could be done with RhinoCommon.

You can use curve’s “Domain” property to set its domain:

domain = Rhino.Geometry.Interval(0, 160)
crv_obj.Domain = domain

(Dale Fugier) #3

Hi Filip,

Why do you want or need to reparameterize the curve? What technical problem are you trying to solve?

– Dale


#4

Hi Dale,

Thansk for taking interest in my question.

The problem is more one for backward compatibility of the code, since the older code assumed that curves start with a curve parameter at 0 and increase when following the curve to the end.

Today, I had a curve that started at -160 and went to 0. This is the correct direction: smaller values near the beginning, larger towards the end, but it would be nicer to let the beginning of the curve coincide with 0 and let the curve parameter increase to the end point for the curve direction of my choice. It would have saved me a couple of hours work today replacing our legacy code…

Thanks in advance,

Filip


(Dale Fugier) #5

Check the Rhino help file for information on the Reparameterize command.


#6

Thanks, that did the trick :wink: