# Superfluous Greville Points?

I’m using NurbsCurve.GrevillePoints to manipulate interpolated curves by code. This works pretty well, but I wonder why this method returns Greville points which are not useful (for me at least

What I’m interested in are these points which create perfect curve duplicates when interpolated with the right flavor. I’d appreciate to have an option to filter these “superfluous” points.

The picture shows these points of two degree 3 curves in red. The curves have been created by interpolating the green points.

Thanks, Jess

Hi Jess,

With a curve’s edit points on, when you move one of the points, the curve will be rebuilt using Greville interpolation. This is not the same kind of interpolation provided by `Curve.CreateInterpolatedCurve`, which is bicubic. My guess this is why are seeing the problems you are.

I guess I like to know more about what you are trying to do (other than what you’ve describe), and why. What problem are you trying to solve?

– Dale

Hi Dale,

I’m using my own method to edit the points. No problem with the interpolation, it creates perfect duplicates.

I was just curious about some points the GrevillePoints method returns. Don’t mind…

Jess

Edit: …wish for a method which returns the Bicubic Edit Points

Hi Dale,

I just noticed that SurfaceEditPoints has the option to avoid these points with the option: return_all=False
So it seems reasonable to have it on curves too?

@stevebaer there is a little buglet in SurfaceEditPoints line 2567 Message: global name ‘nurbs’ is not defined.

This has been fixed for next week’s WIP release.

1 Like

i am trying to do what is explained in the opening post in RH5 and RH6. I get the edit (greville) points and transform them individually in order to create a new interpolated nurbs curve from them. So far this works ok with open degree 3 curves, but with closed or periodic ones i am facing a problem when i use eg.

`Rhino.Geometry.Curve.CreateInterpolatedCurve(points, degree=3)`

The initially closed curves are then open and have overlaps at start / end. I’ve tried to remove duplicate points without success. Is there a way to handle the duplicate greville points somehow ? How can i find out about the knotstyle used when the curve exists and i want to use it as argument with `CreateInterpolatedCurve` ?

Or can i modify the edit points of an existing nurbs curve without re-creating it ?

_
c.

Hi @clement,

I recently added a NurbsCurve.SetGreillePoints method. You might see if this works for you.

– Dale

Thanks @dale, this would be the way to go with RH6, but is there something i can try in RH5 ? Can i get rid of the superfluous greville points which are returned ?

_
c.

Sorry…done…

Hi @clement,

I believe this should do the trick - let me know if you find othewise.

``````import Rhino
import rhinoscriptsyntax as rs

obj_id = rs.GetObject()
crv = rs.coercecurve(obj_id)

nc = crv.ToNurbsCurve()
t_list = nc.GrevilleParameters()

if t_list:
t = 0
t_count = t_list.Count
if nc.IsPeriodic:
t_count -= nc.Order - 1
rc = 0
while True:
if rc < nc.Order - 1 and t_list[t] < nc.Knots[nc.Order-2]:
rc += 1
t += 1
continue
break
elif nc.IsClosed:
t_count -= 1

for n in range(t, t + t_count):
``````

– Dale

1 Like

Thank you a lot dale,

for closed curves clamped at start / end it runs through and i can create a new curve from the points using `CreateInterpolatedCurve`. For closed periodic i see it is missing the point to close which is easy to fix by appending the first point to the end.

But for open curves i get an index out of range from this line:

``````rs.AddPoint(nc.PointAt(t_list[n]))
``````

All my curves are degree 3 if that helps…
_
c.

Hi @clement,

Try changing the 2nd to last line to this:

``````for n in range(t, t + t_count):
``````

The script was meant to replicate what you see when you run `EditPtOn` - you might need to modify for your use.

– Dale

thanks a lot @dale, i guess i figure it out now.

_
c.