-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b38f554
commit e5e7a03
Showing
2 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
% Draw a character "E": | ||
% | ||
% 3------4 | ||
% | | ||
% | | ||
% 2---5 | ||
% | | ||
% | | ||
% 1------6 | ||
% | ||
% Golden ratio | ||
Phi=(1+sqrt5)/2; | ||
% Width in pixel by default | ||
w=100; | ||
% Height | ||
h=Phi*w; | ||
|
||
% Bottom line | ||
y1=y6=0; | ||
% Top line | ||
y3=y4=h; | ||
% Middle line | ||
y2=y5; | ||
% Vertical stroke | ||
x1=x2=x3=0; | ||
|
||
% Make the middle horizontal stroke relatively shorter. | ||
Phi*x5=x6=x4=w; | ||
|
||
% Make the ratio of the areas above and below the middle horizontal a golden ratio. | ||
(y3-y2)=(y2-y1)*Phi; | ||
|
||
draw z1..z6; | ||
draw z2..z5; | ||
draw z3..z4; | ||
draw z1..z3; | ||
|
||
labels(range 1 thru 6); | ||
showit; shipit; end; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
% Exercise 1.13K - Create a capital "K" such that | ||
% 1. The ratio of its height by its width is equal to the golden number. | ||
% 2. The middle point is at the same height as that of the E character in 1.10-SimpleE.mf. | ||
% 3. The south east stroke meets the north east stroke that splits the north east stroke by | ||
% some power of the golden ratio. | ||
% | ||
% 3| /5 | ||
% | / | ||
% 2|/\4 | ||
% | \ | ||
% 1| \6 | ||
% | ||
% Golden ratio | ||
Phi=(1+sqrt5)/2; | ||
% Width in pixel by default | ||
w=100; | ||
% Set the height to satisfy the first requirement. | ||
h=Phi*w; | ||
|
||
% Anchor the bottom. | ||
% Use an arbitrary location other than (0,0) to show that this works without | ||
% an implicit assumption about the origin. | ||
z1=(3, 7); | ||
|
||
% Anchor the top right. | ||
z5=(x1+w, h); | ||
% Anchor the top left. | ||
z3=(x1, h); | ||
% Anchor the bottom right. | ||
z6=(x1+w, y1); | ||
|
||
% Set the height of the middle point to satisfy the second requirement. | ||
(y3-y2)=(y2-y1)*Phi; | ||
x2=x1; | ||
|
||
% Set the position of z4 so it would divide the north east stroke by the golden ratio. | ||
(z4-z2)*Phi*Phi=(z5-z4); | ||
z4=whatever[z2,z5]; | ||
|
||
draw z1..z3; | ||
draw z2..z5; | ||
draw z4..z6; | ||
|
||
labels(range 1 thru 6); | ||
showit; shipit; end; |