;; Sample code for testing Ivy package. ;; Copyright 1995 Kenneth B. Russell(define (set-mfvec3f-from-list mfv my-list index) (if (> (length my-list) 0) (begin (-> mfv 'set1value index (new-sbvec3f (car my-list))) (set-mfvec3f-from-list mfv (cdr my-list) (+ 1 index))))) (define (set-mflong-from-list mfl my-list index) (if (> (length my-list) 0) (begin (-> mfl 'set1value index (car my-list)) (set-mflong-from-list mfl (cdr my-list) (+ 1 index))))) (define my-pts (list #(-4.5 -2.0 8.0) #(-2.0 1.0 8.0) #( 2.0 -3.0 6.0) #( 5.0 -1.0 8.0) #(-3.0 3.0 4.0) #( 0.0 -1.0 4.0) #( 1.0 -1.0 4.0) #( 3.0 2.0 4.0) #(-5.0 -2.0 -2.0) #(-2.0 -4.0 -2.0) #( 2.0 -1.0 -2.0) #( 5.0 0.0 -2.0) #(-4.5 2.0 -6.0) #(-2.0 -4.0 -5.0) #( 2.0 3.0 -5.0) #( 4.5 -2.0 -6.0))) (define my-new-pts (list #(0 0 0) #(0 0 0) #(0 0 0) #(0 0 0) #(0 0 0) #(-3 1 0) #(-.25 1 1) #(0 1 0) #(.25 1 1) #(3 1 0) #(-1 2 0) #(.25 2 0.6) #(0 2 0) #(.25 2 0.6) #(1 2 0) #(0 3 0) #(0 3 0) #(0 3 0) #(0 3 0) #(0 3 0))) (define u-knots (list 0 0 0 0 1 2 2 2 2)) (define v-knots (list 0 0 0 0 1 1 1 1)) (define surfsep (new-soseparator)) (define controlpts (new-socoordinate3)) (define surf (new-sonurbssurface)) (define complexity (new-socomplexity)) (-> surfsep 'ref) (-> (-> complexity 'value) 'setvalue 0.7) (set-mfvec3f-from-list (-> controlpts 'point) my-new-pts 0) (set-mflong-from-list (-> surf 'uKnotVector) u-knots 0) (set-mflong-from-list (-> surf 'vKnotVector) v-knots 0) (-> (-> surf 'numUControlPoints) 'setvalue 5) (-> (-> surf 'numVControlPoints) 'setvalue 4) (-> surfsep 'addchild complexity) (-> surfsep 'addchild controlpts) (-> surfsep 'addchild surf) (define (build-recursive-fern root object index scale-factor x y z angle) (if (> index 0) (begin (define xlate (new-sotranslation)) (-> (-> xlate 'translation) 'setvalue x y z) (-> root 'addchild xlate) (define scale (new-soscale)) (-> (-> scale 'scalefactor) 'setvalue scale-factor scale-factor scale-factor) (-> root 'addchild scale) (define rotate (new-sorotation)) (-> (-> rotate 'rotation) 'setvalue (new-sbvec3f 0.0 0.0 1.0) angle) (-> root 'addchild rotate) (-> root 'addchild object) (define new-root (new-soseparator)) (-> root 'addchild new-root) (build-recursive-fern new-root object (- index 1) scale-factor x y z angle)))) (define fern-root (new-soseparator)) (-> fern-root 'ref) (define material (new-somaterial)) (-> (-> material 'diffusecolor) 'setvalue 0 0.5 0) (-> fern-root 'addchild material) (build-recursive-fern fern-root surfsep 25 0.8 2.0 2.5 0.2 -0.2)
$Id: ivy-fern.html,v 1.1 1995/08/31 01:36:35 kbrussel Exp $