WindTurbines

From MHCGraphics

Jump to: navigation, search
; Mead example file - two wind turbines in the same scene
;
; Jim Teresco
; Computer Science 110
; Mount Holyoke College
;
; $Id: WindTurbines.scm 625 2008-04-13 21:38:48Z terescoj $
;
(require (lib "Defs.ss" "Mead"))

(define bladeLength 100)
(define bladeThickness (/ bladeLength 10))
(define supportHeight 200)
(define supportThickness (/ supportHeight 10))

; first, build a wind turbine blade (just a
; narrow cone for our purposes
(object blade Cone
        (scale .01 .01 .01)
        (scale bladeThickness bladeLength bladeThickness)
        (translate 0 (/ bladeLength 2) (/ supportThickness -2))
        )

; put three together in a group
(object threeBlades Group
        (add blade)
        (add blade (zRot 120))
        (add blade (zRot 240))
        )

; put together a turbine that sits upon the xz-plane
(object turbine Group
        (add threeBlades
             (translate 0 supportHeight 0))
        (add cylinder
             (scale .01 .01 .01)
             (scale supportThickness supportHeight supportThickness)
             (translate 0 (/ supportHeight 2) 0)
             )
        )

; put our turbine in the scene
(tell scene
      (add turbine whitePlastic
           (translate 100 0 0))
      (add turbine whitePlaster
           (translate -100 0 0))
      )

(tell image
      (background '(.5 .5 1))
      (fileName "WindTurbine")
      (frameNumber 0)
      (viewResult #f)
      )

; our adjustment function -- just moves the blades
; by rotating some number of degrees about z
(define (rotateBlade degreesPerFrame)
  ; in this case, the rotation specified will apply to the
  ; threeBlades in both instances of turbine in our scene
  (tell threeBlades (zRot degreesPerFrame))
  )

(tell camera
      (pos '(0 200 -500))
      (coi (list 0 supportHeight 0))
      (film 60 rotateBlade 2)
      (buildMovie)
      )

click here to see the movie

Personal tools