Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
PolygonMorph
Last updated at 2:55 pm UTC on 16 January 2006
The PolygonMorph is a subclass of PolygonMorph. The PolygonMorph is used by the class LineMorph.

Examples:

Draw a filled triangle:

(PolygonMorph
vertices: (Array with: 0@0 with: 200@0 with: 100@100)
color: Color red borderWidth: 1 borderColor: Color black) openInWorld


Draw an empty regular polygon. This example uses the shapeFromPen method. Pen graphics are based on the concepts known from LOGO:

World addMorph: (PolygonMorph
shapeFromPen: [:p | 5 timesRepeat: [p go:50. p turn:72.]]
color: Color transparent borderWidth: 4 borderColor: Color blue)


Draw a smoothed poygon:

b _ (PolygonMorph
vertices: (Array with: 50@100 with: 200@300 with: 100@400)
color: Color red borderWidth: 1 borderColor: Color black).
World addMorph: b.
b beSmoothCurve.


see also Drawing a Hilbert Curve