An example of cartoon drawing
(**expand:boxer-boot*)
(**boxer-version:0,2,0*)
include "g"
GUI = Void
(**boxer-refpoints:
bbox1 0 15.62254126064996 30.738485653167675 bbox2 0 38.042325632563276
11.884963053097344 p1 0 17.466942655683685 38.41059602649007 p2 0
16.606711710513387 28.012545806716286 p3 0 19.619267202635907
21.814899015413467 p4 0 35.51335616474464 22.516556291390728 p5 0
49.42068400658978 22.516556291390728 p6 0 56.20878450082372 24.503311258278142
p7 0 55.877657647446455 32.11920529801324 p8 0 54.55315023393739
40.2317880794702 p9 0 41.80476637891268 39.40397350993377 p10 0
25.579550563426682 39.40397350993378 p11 0 36.15965599999999 29.96734735099338
p12 0 16.977676112026366 10.648626158940402 p13 0 57.4495143196046
11.092715231788077 bbox3 0 -13.872186303630368 71.66291548570511 bbox4 0
86.72461677667766 -10.71606460279045 q1 0 3.244205107084028 -8.153768874172172
q2 0 0.42563179571664733 40.78675562913907 q3 0 74.73347364085666
41.04298874172186 q4 0 72.42736820428337 -3.285339735099342 q6 0
46.54774052718287 14.138511920529808 q7 0 31.17370428336079 14.138511920529801
q8 0 30.661236408566737 -2.772873509933774 q9 0 36.04214909390447
63.84773576158941 q5 0 46.120685579678245 -3.3992215935064216 q10 0
33.06873586358637 -6.231564606467646 q11 0 33.06873586358637 0.9429924731783714
q12 0 43.54590638063807 1.170756189992531 q13 0 43.43202409240925
-6.345446464874726 q14 0 32.95545357535755 3.790038933355362 q15 0
43.54650638063808 3.9039207917624417 q16 0 43.6603886688669 11.761769021850938
q17 0 33.069335863586375 11.761769021850938 q18 0 44.58820711404474
2.924894891116753 q19 0 44.79515882736422 3.2565389382999816 p14 0
12.451959862219105 22.565730312948638 p15 0 11.597840278267299
40.16046247317838 p16 0 26.0608908833278 40.046580614771294 p17 0
26.34559418166421 22.708081567124335 p18 0 27.791089438943906
22.281030703266865 p19 0 27.487404950495062 20.23115725193943 p20 0
11.847561826182632 20.00339353512527 p21 0 11.392035093509365 21.86346388910757
p22 0 13.935463118544874 24.330884154594305 p23 0 13.593816253858407
38.11058902185094 p24 0 24.184869059138936 38.224470880258025 p25 0
24.41263363559658 24.444766013001384 w1 0 15.642478126145953 25.735412533741336
w2 0 15.03510551888522 36.59214970188293 w3 0 22.779074495782908
35.832937312502395 w4 0 23.044796607994133 26.304821825776735 w5 0
16.819260964429784 32.22667846294487 w6 0 16.895185716905036 35.908858551440446
w7 0 20.881035551888527 35.79497669303336 w8 0 22.209660634396784
32.45444217975903 p26 0 55.003460461285016 31.81859668874172 w9 0
19.386943163097207 31.562363576158937 w10 0 18.832149834983504
26.152993889107577 w11 0 21.906971617161723 30.024977074948286 w12 0
17.011233223322336 29.227924066098726 w13 0 22.363900770077016
35.605328136895196 w14 0 15.531163476347654 33.09994725193943 w15 0
18.608385258525868 36.40276114574473 w16 0 12.473883098643205
21.665191073564348 w17 0 26.73018430876422 22.011053905422752 r1 0
-1.79775535420098 34.921801168339165 r2 0 35.78591515650743 61.79787086092716
r3 0 76.4278492586491 35.40586026490067 r4 0 81.1558657331137 39.00966887417219
r5 0 35.78591515650743 67.51772450331126 r6 0 -4.459356672158144
40.670940397350996 r7 0 -3.3640687818864237 40.32372334583602 r8 0
35.65322843557833 66.29826149856414 r9 0 79.550300700755 39.05877557775193 r10
0 -0.5601127800407317 39.43931120263593 r11 0 0.4097673116089613
40.79758653014683 r12 0 2.2889002036659924 38.12369198866213 r13 0
-1.4850840122199536 35.38244613713374 r14 0 74.67426797163762
40.842837959398636 r15 0 76.66789449913252 35.81384232621086 r16 0
76.34450605717733 35.67013306214281 r17 0 73.9198217394584 37.340478040308746
*)
(**end:expand*)// This example shows how to draw a house in a cartoon-ish way.
// I had in mind the typical house here in England...
(**expand:define-all*)
bbox1 = Point[.x=15.6225412606, .y=30.7384856532]
bbox2 = Point[.x=38.0423256326, .y=11.8849630531]
p1 = Point[.x=17.4669426557, .y=38.4105960265]
p2 = Point[.x=16.6067117105, .y=28.0125458067]
p3 = Point[.x=19.6192672026, .y=21.8148990154]
p4 = Point[.x=35.5133561647, .y=22.5165562914]
p5 = Point[.x=49.4206840066, .y=22.5165562914]
p6 = Point[.x=56.2087845008, .y=24.5033112583]
p7 = Point[.x=55.8776576474, .y=32.119205298]
p8 = Point[.x=54.5531502339, .y=40.2317880795]
p9 = Point[.x=41.8047663789, .y=39.4039735099]
p10 = Point[.x=25.5795505634, .y=39.4039735099]
p11 = Point[.x=36.159656, .y=29.967347351]
p12 = Point[.x=16.977676112, .y=10.6486261589]
p13 = Point[.x=57.4495143196, .y=11.0927152318]
bbox3 = Point[.x=-13.8721863036, .y=71.6629154857]
bbox4 = Point[.x=86.7246167767, .y=-10.7160646028]
q1 = Point[.x=3.24420510708, .y=-8.15376887417]
q2 = Point[.x=0.425631795717, .y=40.7867556291]
q3 = Point[.x=74.7334736409, .y=41.0429887417]
q4 = Point[.x=72.4273682043, .y=-3.2853397351]
q6 = Point[.x=46.5477405272, .y=14.1385119205]
q7 = Point[.x=31.1737042834, .y=14.1385119205]
q8 = Point[.x=30.6612364086, .y=-2.77287350993]
q9 = Point[.x=36.0421490939, .y=63.8477357616]
q5 = Point[.x=46.1206855797, .y=-3.39922159351]
q10 = Point[.x=33.0687358636, .y=-6.23156460647]
q11 = Point[.x=33.0687358636, .y=0.942992473178]
q12 = Point[.x=43.5459063806, .y=1.17075618999]
q13 = Point[.x=43.4320240924, .y=-6.34544646487]
q14 = Point[.x=32.9554535754, .y=3.79003893336]
q15 = Point[.x=43.5465063806, .y=3.90392079176]
q16 = Point[.x=43.6603886689, .y=11.7617690219]
q17 = Point[.x=33.0693358636, .y=11.7617690219]
q18 = Point[.x=44.588207114, .y=2.92489489112]
q19 = Point[.x=44.7951588274, .y=3.2565389383]
p14 = Point[.x=12.4519598622, .y=22.5657303129]
p15 = Point[.x=11.5978402783, .y=40.1604624732]
p16 = Point[.x=26.0608908833, .y=40.0465806148]
p17 = Point[.x=26.3455941817, .y=22.7080815671]
p18 = Point[.x=27.7910894389, .y=22.2810307033]
p19 = Point[.x=27.4874049505, .y=20.2311572519]
p20 = Point[.x=11.8475618262, .y=20.0033935351]
p21 = Point[.x=11.3920350935, .y=21.8634638891]
p22 = Point[.x=13.9354631185, .y=24.3308841546]
p23 = Point[.x=13.5938162539, .y=38.1105890219]
p24 = Point[.x=24.1848690591, .y=38.2244708803]
p25 = Point[.x=24.4126336356, .y=24.444766013]
w1 = Point[.x=15.6424781261, .y=25.7354125337]
w2 = Point[.x=15.0351055189, .y=36.5921497019]
w3 = Point[.x=22.7790744958, .y=35.8329373125]
w4 = Point[.x=23.044796608, .y=26.3048218258]
w5 = Point[.x=16.8192609644, .y=32.2266784629]
w6 = Point[.x=16.8951857169, .y=35.9088585514]
w7 = Point[.x=20.8810355519, .y=35.794976693]
w8 = Point[.x=22.2096606344, .y=32.4544421798]
p26 = Point[.x=55.0034604613, .y=31.8185966887]
w9 = Point[.x=19.3869431631, .y=31.5623635762]
w10 = Point[.x=18.832149835, .y=26.1529938891]
w11 = Point[.x=21.9069716172, .y=30.0249770749]
w12 = Point[.x=17.0112332233, .y=29.2279240661]
w13 = Point[.x=22.3639007701, .y=35.6053281369]
w14 = Point[.x=15.5311634763, .y=33.0999472519]
w15 = Point[.x=18.6083852585, .y=36.4027611457]
w16 = Point[.x=12.4738830986, .y=21.6651910736]
w17 = Point[.x=26.7301843088, .y=22.0110539054]
r1 = Point[.x=-1.7977553542, .y=34.9218011683]
r2 = Point[.x=35.7859151565, .y=61.7978708609]
r3 = Point[.x=76.4278492586, .y=35.4058602649]
r4 = Point[.x=81.1558657331, .y=39.0096688742]
r5 = Point[.x=35.7859151565, .y=67.5177245033]
r6 = Point[.x=-4.45935667216, .y=40.6709403974]
r7 = Point[.x=-3.36406878189, .y=40.3237233458]
r8 = Point[.x=35.6532284356, .y=66.2982614986]
r9 = Point[.x=79.5503007008, .y=39.0587755778]
r10 = Point[.x=-0.560112780041, .y=39.4393112026]
r11 = Point[.x=0.409767311609, .y=40.7975865301]
r12 = Point[.x=2.28890020367, .y=38.1236919887]
r13 = Point[.x=-1.48508401222, .y=35.3824461371]
r14 = Point[.x=74.6742679716, .y=40.8428379594]
r15 = Point[.x=76.6678944991, .y=35.8138423262]
r16 = Point[.x=76.3445060572, .y=35.6701330621]
r17 = Point[.x=73.9198217395, .y=37.3404780403]
(**end:expand*)
// We definitely need a brick pattern to draw the walls
// Try to change to (**view: bricks*) to see how this is done.
bricks = Figure[
// Just one brick
brick = Figure[
Poly[0.5, Color[(1.000, 0.496, 0.000)]
p1, p2, p3, p4, p5, p6, p7, p8, p9, p10]
Hot["center", p11]
]
// A brick pattern, which we save to the file "bricks.png"
Put[brick]
Put[brick, "t", Near["center", p12]]
BBox[bbox1, bbox2]
Save["bricks.png", Window["rgb24", Ppi[100]]]
]
house = Figure[
BBox[bbox3, bbox4]
// Colors used below
panes_color = Color[(0.85, 0.95, 1)]
window_color = Color[1]
door_color = Color[(0.545, 0.272, 0.078)]
border = Border[color.black, 0.5, Join["round"], Cap["round"]]
roof_color_bright = Color[(0.9, 0.35, 0.3)]
roof_color = Color[(0.647, 0.165, 0.165)]
// Roof
Poly[r1, r2, r3, r4, r5, r6, Style[roof_color, border]]
Line[r7, r8, r9, roof_color_bright, Border[1, Cap["round"]]]
Poly[r10, r11, r12, r13, Dark[roof_color, 0.3]]
Poly[r14, r15, r16, r17, Dark[roof_color, 0.3]]
// Just to make the floor more regular...
q4.y = q5.y = q8.y = q1.y
// Draw the wall using the brick pattern
pat = Pattern[Image["bricks.png", Scale[3.5]], Extend["reflect"], Filter["best"]]
Poly[q1, q2, q9, q3, q4, q5, q6, q7, q8
Style[pat, border]]
// Now draw the door
Poly[q8, q7, q6, q5, q5
Style[border, door_color]]
Poly[q10, q11, q12, q13, Style[border, Dark[door_color, 0.6]]]
Poly[q14, q15, q16, q17, Style[border, Dark[door_color, 0.6]]]
// And the door handle
Circle[q18, 1]
Circle[q19, 0.3, Color[0.5]]
// Create a window
window = Figure[
window_marks = Border[color.black, 0.3, Cap["round"]]
Poly[p14, p15, p16, p17, Style[border, window_color]]
Poly[p14, p17, p18, p19, p20, p21
Style[border, Dark[window_color, 0.8]]]
Poly[p22, p23, p24, p25, Style[Dark[panes_color, 0.9], border]]
Poly[0.4, w1, w2, w3, w4, Dark[panes_color, 0.95]]
Poly[0.4, w5, w6, w7, w8, panes_color]
Lines[window_marks, w10, w11; w12, w13; w14, w15;
w16, w17]
Hot["center", w9]
]
// And draw it twice
Put[window]
Put[window, "t", Near["center", p26]]
Save["house.png"]
]
(**expand:view:house*)(**end:expand*)