Arrows

From MHCGraphics

Jump to: navigation, search
; Mead example file: Arrows
;
; Jim Teresco
; Computer Science 110
; Mount Holyoke College
; Based on a model by Duane A. Bailey, Williams College
;
; February 13, 2008
;
; $Id: Arrows.scm 481 2008-02-13 18:18:52Z terescoj $
;
(require (lib "Defs.ss" "Mead"))

; Our arrows will have feathers on the tails, so defined those.
; We start with a pair of cubes that cross, which are oriented along the
; y-axis
(object featherParts Group
        (add cube
             (xform
              (scale .3 1 0.025)
              )
             )
        (add cube
             (xform
              (scale 0.025 1 .3)
              )
             )
        )
; Next, intersect the featherParts with a cone to give them a nice
; angled shape.  Note that the feathers are still oriented along the
; y-axis
(object feathers Intersection
        (add featherParts)
        (add cone
             (xform
              (scale .3 1 .3)
              )
             )
        )

; Compose the arrow as the tip, the main shaft, and the feathers.
; We align the whole thing facing up along the y-axis
(object arrow Group
        ; main shaft, always whitePlaster
        (add cylinder whitePlaster
             (xform
              (translate 0 50 0)
              (scale .1 2 .1)
              )
             )
        ; tip, also always whitePlaster
        (add cone whitePlaster
             (xform
              (translate 0 50 0)
              (scale .1 .2 .1)
              (translate 0 200 0)
              )
             )
        ; add in the feathers, but don't specify a material for these
        (add feathers)
        )

; Add a few arrows to the scene
(tell scene
      (add arrow redPlaster
           (xform
            (zRot 90)
            (translate 100 0 0)
            )
           )
      (add arrow greenPlaster
           (xform
            (zRot 75)
            (translate 100 50 0)
            )
           )
      )

(tell camera
      (shoot)
      )
Personal tools