Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
A4 and A3 sheets in Morphic
Last updated at 7:18 pm UTC on 8 June 2018
Exercise with A4 sheets

(not complete yet, add some content and show post script export)

A4 paper, a paper size defined by the ISO 216 standard, measuring 210 297 mm.

The sheets have an aspect ratio of 2 sqrt.

The main advantage of this system is its scaling. Rectangular paper with an aspect ratio of √2 has the unique property that, when cut or folded in half midway between its shorter sides, each half has the same √2 aspect ratio and half the area of the whole sheet before it was divided. Equivalently, if one lays two same-sized sheets paper with an aspect ratio of √2 side-by-side along their longer side, they form a larger rectangle with the aspect ratio of √2 and double the area of each individual sheet.


Here is a way to create Morphs which represent A4 and A3 sheets.


A4_and_A3_sheets_screenshot.png

a4Extent := 210 @ 297 "millimeter". 
scaleFactorForDisplay := 1.2.
a4 := Morph new extent:  a4Extent * scaleFactorForDisplay.
a4 color: Color lightBlue.
a4 openInHand .


a4 := Morph new extent:  a4Extent * scaleFactorForDisplay.
a4 color: Color lightGreen.
a4 openInHand .


a3Extent := a4Extent scaleBy: (2 sqrt @ (2 sqrt)).
a4 := Morph new extent:  a3Extent transposed * scaleFactorForDisplay .
a4 color: Color lightRed.
a4 openInHand .



 a4Extent := 210 @ 297 "millimeter". 
 a4ExtentPrintableArea := 190 @ 277 "millimeter". 
 
 scaleFactorForDisplay := 2.
 a4ExtentForDisplay := a4Extent scaleFactorForDisplay.
 a4 := Morph new extent:  a4ExtentForDisplay.
 a4 color: Color lightBlue.
 

 a4PrintableAreaExtentForDisplay := a4ExtentPrintableArea scaleFactorForDisplay.
 a4PrintableArea := Morph new extent:  a4PrintableAreaExtentForDisplay.
 a4PrintableArea color: Color white.


 a4 addMorph: a4PrintableArea.
 a4PrintableArea center: a4 center.
 a4 openInHand
A4Morph_with_printable_area.png

12 boxes

a4Extent := 210 @ 297 "millimeter". 
a4ExtentPrintableArea := 190 @ 277 "millimeter". 

scaleFactorForDisplay := 2.
a4ExtentForDisplay := a4Extent * scaleFactorForDisplay.
a4 := Morph new extent:  a4ExtentForDisplay.
a4 color: Color lightBlue.


a4PrintableAreaExtentForDisplay := a4ExtentPrintableArea * scaleFactorForDisplay.
a4PrintableArea := Morph new extent:  a4PrintableAreaExtentForDisplay.
a4PrintableArea color: Color white.


a4 addMorph: a4PrintableArea.

boxHeight := (a4PrintableArea height) /4.

boxWidth := (a4PrintableArea width) /3.
innerBoxWidth := boxHeight / (2 sqrt).

0 to: 3 do: [:row |
	0 to: 2 do: [:col | 
		box:= Morph new extent: innerBoxWidth@boxHeight; color: Color random; borderWidth: 0.
		centerPoint := ((col+0.5) * boxWidth)@((row+0.5) * boxHeight).
		box center: centerPoint.
		a4PrintableArea addMorph: box ]
	].

a4PrintableArea center: a4 center.
a4 openInHand