Hello! everyone, I have recently read several articles on curve sampling and surface sampling ,Are there any samples of curve sampling and surface sampling I can learn from?
//Joann
Hello! everyone, I have recently read several articles on curve sampling and surface sampling ,Are there any samples of curve sampling and surface sampling I can learn from?
//Joann
Probably there are, but its not rocket science…
I think what you have to understand is that a NurbsCurve is a parametric equation which allows you the access any point on a curve by setting a parameter (t). This basic algorithm is called „de Boor“ for Nurbs or „de Casteljau“ for Beziers, or very often just „Point on Curve“.
This means you can divide points on a curve by providing a series of parameters in range of the visible part of a curve („Curve Interval“). You can set the spacing of the parameter equally (which is not equally sizing), you can divide by arc length which is curvature related, you can apply them from sphere intersection or you custom create a series of ranged numbers. Thats pretty simple I guess. To read more about the math have a look at the „The Nurbs Book“.
You can also check the OpenNurbs repro on Github!
TomTom, that was very well explained in an easy to understand language! They say that if you can’t explain something in an easy to understand fashion then you don’t know the topic well enough… and you obviously know your nurbs! Cudos!
Thanks! Tom, Thank you for your reply, I still have a lot of things to learn!
Hi @15951991225,
The following simple Python script will arc-length sample a selected curve 50 times:
import Rhino
import rhinoscriptsyntax as rs
import scriptcontext as sc
curve_id = rs.GetObject("Select curve to sample 50 times", rs.filter.curve)
curve = rs.coercecurve(curve_id)
count = 50
for x in range(count):
s = x / (count - 1)
rc, t = curve.NormalizedLengthParameter(s)
pt = curve.PointAt(t)
sc.doc.Objects.AddPoint(pt)
sc.doc.Views.Redraw()
Let me know of this helps.
– Dale
Thanks! Dale, this sample is very useful !