Extrusions revisited

I’ve improved and tidied up the extrusion code and added it to the fluxus collection. Here’s an animation and the documentation:

(build-extrusion profile-list path-list width-list tex-vscale up)
Returns primitive-id

Returns an indexed polygon primitive made by extruding the profile
along path and scaling using values in width. The path and width
lists need to be the same size. tex-vscale allows you to scale
the texture coordinates along the length of the extrusion. An
up vector is needed for aiming the profile along the path.

     (build-circle-profile 20 0.3)
         (vector 0 0 0)
         (vector 0 1 2)
         (vector 0 -1 4)
         (vector 0 0 6))
     (list 0 1 1 0) 1 (vector 0 1 0))

(build-partial-extrusion profile-list path-list tex-vscale)
Returns primitive-id

Builds a primitive ready to be used with partial-extrusion. Use
this is for animating growth along extrusions.

(partial-extrude profile-list t profile-list path-list width-list up grow-value)
Returns primitive-id

Animates growth along extrusions. t is a value between 0 and the
length of the path, and controls how far along the extrusion to
calculate. Grow value is a scale to control how much the profile
is scaled to change it’s width as it grows.


 (define profile (build-circle-profile 10 0.3))
 (define path (build-list 20 (lambda (i) (vector (crndf) (crndf) i))))
 (define width (build-list 20 (lambda (_) 1)))
 (define p (build-partial-extrusion profile path 1))
     (with-primitive p
         (partial-extrude (* (length path) 0.5 (+ (sin (time)) 1)) 
             profile path width (vector 0 1 0) 0.1))) 

Leave a Reply

Your email address will not be published. Required fields are marked *