[Fluxus] "intelligent" modelling

Kassen signal.automatique at gmail.com
Fri Feb 5 09:36:24 PST 2010


Dear list,

I've been wondering whether what I was doing (building a naive village) made
any sense at all. Of course anything that makes us smile has a use there and
I've been trying to challenge myself to teach myself Scheme, but I couldn't
escape the feeling that one could do most of the end result in Blender in
less time. Now I have a exception to that. The problem was "fields". Fields
here are any area contained by a fence and the problem was where to place
fence-posts for (rectangular) fields of arbitrary sizes. The code I'm
posting below is really rather simple from a scheming perspective, but I'm
very happy with it as a take on 3d modelling where the computer gets to do
all of the boring stuff, so I thought I'd share. It holds up for fields
where one dimension is 0, fields with negative sizes make it muck up, but
that should be ok.

Yours,
Kas.

(clear)

(with-state
    (colour (vector 0 1 0))
    (scale 10)
    (build-plane))



(define wood_col (vector .5 .5 0))

(define (build-post height)
    (with-state
        (rotate (vector 90 0 0))
        (scale (vector .05 height .05))
        (colour wood_col)
        (build-cylinder 2 10)))



(define (build-fence length)
    (with-state
        (with-state
            (colour wood_col)
            (rotate (vector  90 0 0))
            (translate (vector (/ length 2) .4 0))
            (scale (vector length .1 1))
            (build-plane)
            (translate (vector 0 -2 0))
            (build-plane))

        (let ((nmbr_of_posts (floor (/ length .7))))
        (cond ((zero? nmbr_of_posts) (set! nmbr_of_posts 1)))
        (for* ((x (in-range 0 nmbr_of_posts)))
            (translate (vector (/ length nmbr_of_posts) 0 0))
            (build-post .5)))))

(define (build-field x y)
    (with-state
        (translate (vector (- 0 (/ x 2)) (- 0 (/ y 2)) 0))
        (build-fence x)
        (translate (vector x 0 0))
        (rotate (vector 0 0 90))
        (build-fence y)
        (translate (vector y 0 0))
        (rotate (vector 0 0 90))
        (build-fence x)
        (translate (vector x 0 0))
        (rotate (vector 0 0 90))
        (build-fence y)))

(build-field 2 3)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pawfal.org/pipermail/fluxus-pawfal.org/attachments/20100205/5c342703/attachment-0001.htm>


More information about the Fluxus mailing list