Skip to content

Commit aac5797

Browse files
committed
Merge branch 'master' of https://github.com/mad4j/book-mdpc
2 parents 18d1dd2 + c7ff778 commit aac5797

2 files changed

Lines changed: 45 additions & 53 deletions

File tree

examples/volume6-index.png

85 Bytes
Loading

examples/volume6/spectre/README.md

Lines changed: 45 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -29,76 +29,68 @@ final color PAPER = color(240);
2929
final color INK = color(140, 5, 5);
3030

3131
final float AXIS = 499.5;
32+
final float Y0 = 0.0;
33+
final float Y1 = 999;
3234

3335

3436
final float[] HP = {
3537
481,0, 480,1, 473,1, 472,2, 459,4, 436,12, 419,21, 392,41,
3638
375,60, 361,81, 361,83, 355,93, 354,98, 352,102, 349,112, 347,119,
37-
346,121, 346,127, 345,128, 345,135, 344,136, 344,166, 345,167, 345,174,
38-
346,175, 346,180, 347,181, 350,195, 354,208, 363,227, 372,240, 377,244,
39-
394,268, 405,281, 414,296, 418,306, 418,312, 419,313, 419,325, 418,326,
40-
417,333, 413,339, 405,346, 394,352, 389,352, 388,353, 375,353, 373,352,
41-
369,352, 362,350, 344,341, 299,311, 295,310, 272,295, 262,291, 260,289,
42-
232,275, 226,274, 223,272, 212,269, 204,268, 191,263, 186,263, 179,261,
43-
168,261, 167,260, 129,260, 128,261, 114,262, 91,269, 67,281, 57,289,
44-
44,301, 30,321, 19,340, 8,372, 7,381, 3,392, 3,397, 2,398,
45-
1,420, 0,422, 0,481, 1,482, 1,493, 2,495, 2,502, 3,503,
46-
3,510, 5,511, 7,531, 9,537, 9,541, 10,542, 11,551, 14,555,
47-
17,572, 22,584, 22,587, 27,604, 32,613, 32,615, 50,654, 54,660,
48-
60,666, 64,667, 66,666, 69,659, 69,651, 68,649, 66,629, 65,628,
49-
65,623, 64,622, 64,616, 62,615, 62,610, 61,608, 61,603, 60,602,
50-
60,595, 59,594, 57,566, 56,565, 56,553, 54,552, 54,539, 53,538,
51-
53,461, 54,460, 54,448, 56,447, 57,429, 58,428, 58,423, 59,422,
52-
61,409, 67,394, 76,378, 90,365, 103,358, 111,358, 112,357, 126,358,
53-
136,363, 145,371, 151,381, 152,391, 153,392, 153,403, 152,404, 152,412,
54-
151,413, 151,417, 149,424, 149,430, 148,431, 148,440, 146,441, 146,450,
55-
145,451, 145,465, 144,466, 144,517, 145,518, 145,531, 146,532, 146,542,
56-
148,543, 150,569, 152,575, 152,581, 153,582, 154,593, 158,604, 159,614,
57-
163,628, 163,633, 165,634, 167,646, 169,651, 173,666, 175,670, 176,678,
58-
181,688, 187,710, 192,719, 198,726, 202,726, 208,721, 209,704, 208,703,
59-
208,689, 207,688, 207,681, 205,680, 205,674, 204,673, 204,662, 203,660,
60-
202,637, 201,636, 201,618, 200,617, 200,581, 199,580, 199,572, 200,571,
61-
200,522, 201,521, 201,511, 202,510, 205,476, 207,475, 207,469, 208,468,
62-
209,459, 215,444, 221,431, 229,423, 241,415, 247,413, 269,413, 285,419,
63-
293,427, 297,434, 302,445, 302,449, 304,456, 305,477, 304,478, 303,502,
64-
302,503, 302,601, 303,602, 304,629, 305,631, 305,638, 307,639, 307,646,
65-
308,647, 308,655, 309,656, 310,668, 311,669, 311,674, 312,675, 321,714,
66-
328,733, 341,760, 345,763, 350,763, 354,758, 353,728, 352,727, 350,690,
67-
349,689, 349,612, 350,611, 350,593, 351,592, 351,579, 352,577, 353,559,
68-
354,558, 354,550, 355,549, 355,539, 356,538, 356,531, 358,530, 358,525,
69-
361,517, 361,513, 369,497, 377,487, 388,478, 397,475, 413,475, 414,476,
70-
422,477, 431,481, 443,491, 448,499, 455,512, 459,527, 460,528, 460,531,
71-
461,532, 463,549, 464,550, 464,556, 465,558, 467,582, 468,583, 468,594,
72-
469,595, 469,608, 470,610, 470,627, 471,628, 471,646, 472,647, 472,664,
73-
473,665, 473,680, 475,681, 476,715, 477,716, 478,761, 479,762, 479,780,
74-
480,781, 481,815, 482,816, 485,886, 486,887, 486,904, 487,905, 487,916,
75-
488,917, 488,935, 489,936, 489,955, 490,956, 492,991, 494,997, 496,999,
76-
503,999, 507,993, 509,968, 510,967, 512,917
39+
346,121, 346,127, 345,128, 345,135, 344,166, 345,167, 345,174, 346,175,
40+
346,180, 347,181, 350,195, 354,208, 363,227, 372,240, 377,244, 394,268,
41+
405,281, 414,296, 418,306, 418,312, 419,313, 419,325, 418,326, 417,333,
42+
413,339, 405,346, 394,352, 388,353, 375,353, 373,352, 362,350, 344,341,
43+
299,311, 295,310, 272,295, 262,291, 260,289, 232,275, 226,274, 223,272,
44+
212,269, 204,268, 191,263, 179,261, 168,261, 167,260, 129,260, 128,261,
45+
114,262, 91,269, 67,281, 57,289, 44,301, 30,321, 19,340, 8,372,
46+
7,381, 3,392, 3,397, 2,398, 1,420, 0,422, 0,481, 1,482,
47+
1,493, 2,495, 2,502, 3,503, 3,510, 5,511, 7,531, 9,537,
48+
9,541, 10,542, 11,551, 14,555, 17,572, 22,584, 22,587, 27,604,
49+
32,613, 32,615, 50,654, 54,660, 60,666, 64,667, 66,666, 69,659,
50+
69,651, 68,649, 66,629, 65,628, 65,623, 64,622, 64,616, 62,615,
51+
62,610, 61,608, 61,603, 60,602, 60,595, 59,594, 57,566, 56,565,
52+
56,553, 54,552, 54,539, 53,538, 53,461, 54,460, 54,448, 56,447,
53+
57,429, 58,428, 58,423, 59,422, 61,409, 67,394, 76,378, 90,365,
54+
103,358, 111,358, 112,357, 126,358, 136,363, 145,371, 151,381, 152,391,
55+
153,392, 153,403, 152,404, 152,412, 151,413, 151,417, 149,424, 149,430,
56+
148,431, 148,440, 146,441, 146,450, 145,451, 145,465, 144,466, 144,517,
57+
145,518, 145,531, 146,532, 146,542, 148,543, 150,569, 152,575, 152,581,
58+
153,582, 154,593, 158,604, 159,614, 163,628, 163,633, 165,634, 167,646,
59+
169,651, 173,666, 175,670, 176,678, 181,688, 187,710, 192,719, 198,726,
60+
202,726, 208,721, 209,704, 208,703, 208,689, 207,688, 207,681, 205,680,
61+
205,674, 204,673, 204,662, 203,660, 202,637, 201,636, 201,618, 200,617,
62+
200,581, 199,580, 199,572, 200,571, 200,522, 201,521, 201,511, 202,510,
63+
205,476, 207,475, 207,469, 208,468, 209,459, 215,444, 221,431, 229,423,
64+
241,415, 247,413, 269,413, 285,419, 293,427, 297,434, 302,445, 302,449,
65+
304,456, 305,477, 304,478, 303,502, 302,503, 302,601, 303,602, 304,629,
66+
305,631, 305,638, 307,639, 307,646, 308,647, 308,655, 309,656, 310,668,
67+
311,669, 311,674, 312,675, 321,714, 328,733, 341,760, 345,763, 350,763,
68+
354,758, 353,728, 352,727, 350,690, 349,689, 349,612, 350,611, 350,593,
69+
351,592, 351,579, 352,577, 353,559, 354,558, 354,550, 355,549, 355,539,
70+
356,538, 356,531, 358,530, 358,525, 361,517, 361,513, 369,497, 377,487,
71+
388,478, 397,475, 413,475, 414,476, 422,477, 431,481, 443,491, 448,499,
72+
455,512, 459,527, 460,528, 460,531, 461,532, 463,549, 464,550, 464,556,
73+
465,558, 467,582, 468,583, 468,594, 469,595, 469,608, 470,610, 470,627,
74+
471,628, 471,646, 472,647, 472,664, 473,665, 473,680, 475,681, 476,715,
75+
477,716, 478,761, 479,762, 479,780, 480,781, 481,815, 482,816, 485,886,
76+
486,887, 486,904, 487,905, 487,916, 488,917, 488,935, 489,936, 489,955,
77+
490,956, 492,991, 494,997, 496,999, 503,999, 507,993, 509,968, 510,967,
78+
512,917
7779
};
7880

7981

8082
void setup() {
81-
size(480,640);
83+
size(480, 640);
8284
noLoop();
8385
}
8486

8587

8688
void draw() {
8789
background(PAPER);
8890

89-
float hw=0;
90-
float y0=999;
91-
float y1=0;
91+
float s = min(width/(2*AXIS), height/(Y1-Y0)) * .9;
9292

93-
for(int i=0; i<HP.length; i+=2){
94-
hw = max(hw, abs(HP[i]-AXIS));
95-
y0 = min(y0, HP[i+1]);
96-
y1 = max(y1, HP[i+1]);
97-
}
98-
99-
float s = min(width/(2*hw), height/(y1-y0)) * .9;
100-
101-
translate(width/2-AXIS*s, height/2-(y0+y1)/2*s);
93+
translate(width/2-AXIS*s, height/2-(Y0+Y1)/2*s);
10294

10395
scale(s);
10496
fill(INK);

0 commit comments

Comments
 (0)