From MHCGraphics
; Mead example file -- a simple Patch Mesh
;
; Jim Teresco
; Computer Science 110
; Mount Holyoke College
;
; $Id: PatchMesh.scm 643 2008-04-20 19:04:45Z terescoj $
;
(require (lib "Defs.ss" "Mead"))
; Some image settings appropriate for animations
(tell image
(fileName "PatchMesh")
(frameNumber 0)
(viewResult #f)
)
; And some standard image properties
(tell image
(background '(.5 .5 1))
)
; we can define a mesh face whose sides are described
; by Bezier curves, plus the 4 interior control points
; by default, the refinement level is 3
(object normalOne PatchMesh
(addPatch '((25 -10 0) (25 50 -50) (75 50 50) (100 0 0)
(0 0 25) (25 0 25) (75 0 25) (100 0 25)
(0 0 75) (25 0 75) (75 0 75) (100 0 75)
(0 0 100) (25 -50 100) (75 -50 100) (100 0 100)
)
)
)
(object blockyOne PatchMesh
(addPatch '((25 -10 0) (25 50 -50) (75 50 50) (100 0 0)
(0 0 25) (25 0 25) (75 0 25) (100 0 25)
(0 0 75) (25 0 75) (75 0 75) (100 0 75)
(0 0 100) (25 -50 100) (75 -50 100) (100 0 100)
)
)
(refinement 1)
)
(object smoothOne PatchMesh
(addPatch '((25 -10 0) (25 50 -50) (75 50 50) (100 0 0)
(0 0 25) (25 0 25) (75 0 25) (100 0 25)
(0 0 75) (25 0 75) (75 0 75) (100 0 75)
(0 0 100) (25 -50 100) (75 -50 100) (100 0 100)
)
)
(refinement 5)
)
; add an extra light source
(tell scene
(add bulb (translate 50 200 50))
)
; add some copies of the patch mesh, with different refinement
; levels
; the red one will have the default refinement of 3
(tell scene
(add normalOne redPlaster)
)
; the blue one will look blocky, with a refinement of 1
(tell scene
(add blockyOne bluePlaster
(translate -150 0 0))
)
; the green one will be smoother, with a refinement of 5
(tell scene
(add smoothOne greenPlaster
(translate 150 0 0))
)
; we'll put in some axes so we can see what's going on
; when the camera moves
(object axis Cylinder
(scale .02 50 .02)
)
(tell scene
(add axis blackPlaster)
(add axis blackPlaster (zRot 90))
(add axis blackPlaster (xRot 90))
)
; and a floor so we can see some shadows
(tell scene
(add (new Plane) whitePlaster
(translate 0 -100 0)))
; movement function - just moving the camera around the patch
(define (moveCamera position)
(tell camera (pos position)))
(tell camera
(film 90 moveCamera
'((0 200 -500) (700 500 0) (0 200 500))
)
(buildMovie)
)