1/1

Guile RMan #8 くりかえし処理その1

関数を定義し、繰り返し処理を行いました。
sphere6.jpg
いろいろできそうです。

#!/usr/bin/guile -s
!#

(use-modules (rman rispec))
(use-modules (rman utilities))

(RiBegin "test6.rib")
(RiDisplay "sphere6.tif" "file" "rgb")
(RiFormat 640 480 1)
(RiProjection "perspective" '("fov" 40.0))
(RiTranslate 0 0 6)
(RiPixelFilter RiBoxFilter 1 1)
(RiWorldBegin)
(RiLightSource "ambientlight" (list "intensity" 0.2))
(RiLightSource "distantlight" (list "intensity" 1.2
"uniform point from" (Point 3 3 -3)))

(define (test x)
(define posx -3)
(let ((n 0))
(while (< n x)
(RiTransformBegin)
(set! posx (+ posx 1 ))
(RiTranslate posx 0 0 )
(RiColor (Color .9 .1 .1))
(RiSurface "plastic")
(RiSphere 0.5 -0.5 0.5 360)
(set! n (+ n 1))
(RiTransformEnd)
)))

(test 5)

(RiWorldEnd)
(RiEnd)



(use-modules (rman ri2rib))
を使うと空のRIBが出るだけで、課題です。
以下、エラー。
guile: symbol lookup error: /usr/local/lib/libguile_rman_ri2rib.so: undefined symbol: RifGetDeclaration
  • -
  • -

Guile RMan #9 くりかえし処理その2

球体の色を徐々に変化させてみた。
guile-rmanとAqsis1.6 (CentOS6.4 64bitで稼働。)
sphere70.jpg

#!/usr/bin/guile -s
!#

(use-modules (rman rispec))
(use-modules (rman utilities))

(RiBegin "test7.rib")
(RiDisplay "sphere7.tif" "file" "rgb")
(RiFormat 640 480 1)
(RiProjection "perspective" '("fov" 40.0))
(RiTranslate 0 0 6)
(RiPixelFilter RiBoxFilter 1 1)
(RiWorldBegin)
(RiLightSource "ambientlight" (list "intensity" 0.2))
(RiLightSource "distantlight" (list "intensity" 1.2
"uniform point from" (Point 3 3 -3)))

(define (test x)
(define posx -3)
(define col 0.2)
(define col2 0.9)
(let ((n 0))
(while (< n x)
(RiTransformBegin)
(set! posx (+ posx 1 ))
(RiTranslate posx 0 0 )
(set! col (+ col .2))
(set! col2 (- col2 .2))
(RiColor (Color col .2 col2))
(RiSurface "plastic")
(RiSphere 0.5 -0.5 0.5 360)
(set! n (+ n 1))
(RiTransformEnd)
)))

(test 5)

(RiWorldEnd)
(RiEnd)

  • -
  • -

Guile RMan #10 くりかえし処理その3

guileで乱数を発生させた。毎回変化させるには、
(set! *random-state* (random-state-from-platform))
を記述しておいた。
(RiColor (Color (random 1.0) (random 1.0) (random 1.0)))
たぶん、0から1までの乱数と思われる。
sphere7r.jpg
sphere7r2.jpg

#!/usr/bin/guile -s
!#

(use-modules (rman rispec))
(use-modules (rman utilities))

(RiBegin "test7.rib")
(RiDisplay "sphere7.tif" "file" "rgb")
(RiFormat 640 480 1)
(RiProjection "perspective" '("fov" 40.0))
(RiTranslate 0 0 6)
(RiPixelFilter RiBoxFilter 1 1)
(RiWorldBegin)
(RiLightSource "ambientlight" (list "intensity" 0.2))
(RiLightSource "distantlight" (list "intensity" 1.2
"uniform point from" (Point 3 3 -3)))

(define (test x)
(define posx -3)
(set! *random-state* (random-state-from-platform))
(let ((n 0))
(while (< n x)
(RiTransformBegin)
(set! posx (+ posx 1 ))
(RiTranslate posx 0 0 )
(RiColor (Color (random 1.0) (random 1.0) (random 1.0)))
(RiSurface "plastic")
(RiSphere 0.5 -0.5 0.5 360)
(set! n (+ n 1))
(RiTransformEnd)
)))

(test 5)

(RiWorldEnd)
(RiEnd)

  • -
  • -

Guile RMan #11 くりかえし処理その4

sin、cosを利用した。半径1の円周上に球体を12個、配置した。
色は乱数を発生させた。
sphere8.jpg
sphere8r.jpg

#!/usr/bin/guile -s
!#

(use-modules (rman rispec))
(use-modules (rman utilities))

(RiBegin "test8.rib")
(RiDisplay "sphere8.tif" "file" "rgb")
(RiFormat 640 480 1)
(RiProjection "perspective" '("fov" 40.0))
(RiTranslate 0 0 4)
(RiPixelFilter RiBoxFilter 1 1)
(RiWorldBegin)
(RiLightSource "ambientlight" (list "intensity" 0.2))
(RiLightSource "distantlight" (list "intensity" 1.2
"uniform point from" (Point 3 3 -3)))

(define (test x)
(define N1 12)
(define PI 3.141592)
(set! *random-state* (random-state-from-platform))
(let ((n 0))
(while (< n x)
(RiTransformBegin)
(RiTranslate (sin (* 2 (/ PI N1) n)) (cos (* 2 (/ PI N1) n)) 0 )
(RiColor (Color (random 1.0) (random 1.0) (random 1.0)))
(RiSurface "plastic")
(RiSphere 0.25 -0.25 0.25 360)
(set! n (+ n 1))
(RiTransformEnd)
)))

(test 12)

(RiWorldEnd)
(RiEnd)
  • -
  • -

1/1