ScriptSpot

Forum topic · Scripts Wanted

Graduated Interpolation on Spline

By asymptote · 2015-10-04

Description

Is it possible to select a spline and graduate the vert distribution from one end to another ? Like normalise spline, but with the ability to spread out the verts and have them graduate closer together (increase in number) at one end.

 

thx

 

Comments (1)

`

pixamoon · 2015-10-06

hey, try something like this:


sp = $
if sp != undefined and superclassof sp == shape do (
	t = timestamp() 
	nSp = splineShape()
	addNewSpline nSp
	addKnot nSp 1 #corner #line (lengthInterp sp 1 0.0)
	
	step = 0.1
	begin = 0.0001 -- needs to be almost 0
	
	i = begin * step
	lp = true
	do (
		addKnot nSp 1 #corner #line (lengthInterp sp 1 i steps:10000)
		i = i * (step + 1)
		if i >= 1 or timestamp() - t > 5000 then lp = false
	) while lp
	
	addKnot nSp 1 #corner #line (lengthInterp sp 1 1.0)
	updateShape nSp
	select nSp
	subobjectlevel = 1
)

Cheers,
Pixamoon