ScriptSpot

Forum topic · Scripts Wanted

Helix

By JokerMartini · 2010-12-02

Description

A Helix/Spring creating spline that allows for adjusting the spacing of the knots on the spline.

Comments (4)

Anubis · 2010-12-03

is i miss something... the circle shape has 4 knots and you can divide it segments, or if create circle with addKnot need to supply amount of knots and angle, and the same is for the spiral/helix. in the example code - 12 knots with angle 30 end with full turn (12*30=360).

Anubis

JokerMartini · 2010-12-03

Hey Anubis, You got it 100% right.
That is what i wanted. Great work!
Thanks!

JokerMartini · 2010-12-03

Yeah just like that. But have the option to choose the amount of knots in the spline. Like when you make a circle you can adjust that.

somthing like this?... (

Anubis · 2010-12-02

somthing like this?...

(
  spline = splineShape() 
  addNewSpline spline
  addKnot spline 1 #smooth #curve [0,0,0]
  numK = 12 -- num.knots
  incr = pi -- increment
  rad = for i = 1 to numK collect i * incr
  ang = 30 -- angle
  points = for i = 1 to numK collect [rad[i]*(sin(i*ang)),rad[i]*(cos(i*ang)),0]
  for p in points do addKnot spline 1 #smooth #curve p
  updateShape spline
)