From MHCGraphics
; Mead example file -- some objects built with Bezier curves
;
; Jim Teresco
; Computer Science 110
; Mount Holyoke College
;
; $Id: SimpleBezier.scm 612 2008-04-06 01:19:20Z terescoj $
;
(require (lib "Defs.ss" "Mead"))
; We define an outline polygon like others we have seen for
; Prism, Lathe, extrude, sweep operations.
; The main oddity here is that the point (75 0) is repeated.
; For the operations we have seen previously, this repeated
; point will have no effect, but when specifying Bezier curves,
; we need to specify points in groups of 4, and if they are to
; be connected, the 4th point of one group must match the 1st
; of the next group.
(define outline
(2to3d '((0 0) (25 100) (50 25) (75 0)
(75 0) (50 -25) (25 -100) (0 0))))
; we can build a Prism from this outline
(object spikyPrism Prism
(profile outline)
)
; but we can also create a Prism and send it an additional
; message to indicate that the outline should be treated as
; a sequence of points defining Bezier curves.
(object roundedPrism Prism
(profile outline)
(bezier)
)
; same outline, but a Lathe this time
(object spikyLathe Lathe
(profile outline)
)
; and a Bezier version of the Lathe
(object roundedLathe Lathe
(profile outline)
(bezier)
)
; let's build a Lathe with a single Bezier curve with
; endpoints on the y-axis
(define outline2
(2to3d '((0 0) (25 25) (200 75) (0 100))))
(object latheObject Lathe
(profile outline2)
(bezier)
)
; add one of each to the scene
(tell scene
(add spikyPrism redPlaster
(translate 100 100 0)
)
(add roundedPrism redPlaster
(translate -100 100 0)
)
(add spikyLathe redPlaster
(translate 100 -150 0)
)
(add roundedLathe redPlaster
(translate -100 -150 0)
)
(add latheObject redPlaster
(translate -250 0 0)
)
)
(tell image
(background white)
(width 1024)
)
(tell camera
(pos '(0 300 -500))
(angle 70)
(shoot)
(pos '(0 -100 -500))
(shoot)
)