hi Luis,

Thanks Gabor for the script about finding the verts number,
it'great.
you are welcome. i'm glad it's useful.

I have another question, when you say that the "pdata-index-map!
supplies the current pdata index number to the procedure", do you
refer that I am giving a name to the current pdata?
no, it has a different function. i believe you are familiar with pdata-ref and pdata-set! to read and write pdata. if you understand pdata-map!, pdata-index-map! is similar it just gives you the index of the pdata in the list as well as its current value.

the following example sets the colour of the torus vertices. low indices get dark colour, high ones get lighter ones, which demonstrates the use of the index in pdata-index-map!

(clear)

(define prim (build-torus 1 2 10 20))

(with-primitive prim
    (hint-vertcols)
    (pdata-index-map!
        (lambda (i c)
            (/ i (pdata-size)))
        "c"))

best,
gabor

Reply via email to