[Fluxus] load-primitive vs recalc-normals

Kassen signal.automatique at gmail.com
Tue May 3 17:03:23 PDT 2011


Dear List,

When I save a primitive as a .obj file in fluxus, then load this and try to
use (recalc-normals ) on the result I only get angular results. This seems
regardless of the setting of either the parameter to (recalc-normals ) on
the resulting primitive or the original amount of smoothing on the saved
one. I believe this to be a bug. I'll post versions of my code for reference
below.

Yours,
Kas.

;----------------------in.scm-----------------------------------------------------------
;saves a range of shapes from "pebble" to "brick", crude version
(clear)

(define (build-stone size amount)
    (letrec ((clamp (λ (x y) ((if (positive? x)+ -) x (* y (- 1  (magnitude
x)))) )))
            (let ((stone (build-icosphere 2)))
                (with-primitive stone
                    (pdata-map!
                        (λ (position)
                            (let (  (ult (biggest position))
                                    (px (vector-ref position 0))
                                    (py (vector-ref position 1))
                                    (pz (vector-ref position 2)))
                                (vector
                                    (if (eq? ult 0) (clamp px amount) (clamp
px (min amount (magnitude px))))
                                    (if (eq? ult 1) (clamp py amount) (clamp
py (min amount (magnitude py))))
                                    (if (eq? ult 2) (clamp pz amount) (clamp
pz (min amount (magnitude pz)))))))
                        "p")
                    (scale size)
                    (colour .5)
                    (recalc-normals 1)
                    (hint-normalise))
                stone)))

(for ((x (in-range 0 10)))
        (with-primitive (build-stone (vector 1 1 1) (* x .1))
            (save-primitive (string-append "brick" (number->string x)
".obj"))))



;---------------------------------------out.scm--------------------------------
(clear)

(define test (load-primitive "/bricks/brick2.obj"))

(with-primitive test
    (colour .5)
    (recalc-normals 1))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pawfal.org/pipermail/fluxus-pawfal.org/attachments/20110504/00abecd2/attachment-0001.htm>


More information about the Fluxus mailing list