Hi all,
I regularly need to get smooth curves through some given points. Up to now I use the code given below based on nurbs.
For nurbs, the resulting curve will not definitly go through the points (per definition). Increasing the weight of some points in order to constrain the curve more towards these points results (at least for me) in less smooth (kinked) curves.
Is there a possibility to have a smooth curve matching the given points exactly?
Either by using some non-nurbs fit? how would the python code look like?
Or can I increase the region of effect of a node weight such that it does attract a wider part of the curve (more nonlocal) such that the curve gets not so kinky? Pythonic way?
Thanks
Alex
def curveFromPoints(coords,name,tClosed):
# create the Curve Datablock
curveData = bpy.data.curves.new(name, type='CURVE')
curveData.dimensions = '3D'
curveData.resolution_u = 2
# map coords to spline
polyline = curveData.splines.new('NURBS')
polyline.points.add(len(coords)-1)
for i, coord in enumerate(coords):
x,y,z = coord
polyline.points[i].co = (x, y, z, 1)
if(tClosed):
polyline.use_cyclic_u = True
# create Object
curveOB = bpy.data.objects.new(name, curveData)
# attach to scene and validate context
scn = bpy.context.scene
scn.objects.link(curveOB)
scn.objects.active = curveOB
curveOB.select = True