From b935b2190b7058634a3308f720d824e0d0e7e8ce Mon Sep 17 00:00:00 2001 From: xenofem Date: Tue, 26 Jul 2022 20:17:17 -0400 Subject: [PATCH 01/11] add blank spaces for face card 'numerals' --- numerals.asy | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/numerals.asy b/numerals.asy index d7ef100..ffe7965 100644 --- a/numerals.asy +++ b/numerals.asy @@ -1,5 +1,10 @@ import "scaling.asy" as scaling; +int TRAVELER = 7; +int KNIGHT = 8; +int WIZARD = 9; +int NOBLE = 10; + path numerals[][] = { {} }; path onearc = arc((0,height*0.4), height*0.1, 0, 180); @@ -20,3 +25,16 @@ numerals.push(five); path[] six; numerals.push(six); + +path[] traveler; +numerals.push(traveler); + +path[] knight; +numerals.push(knight); + +path[] wizard; +numerals.push(wizard); + +// Is this even the same across suits? or is it like, *C*ount of Cards, *Q*ueen of Puppets, ??? of Bread, etc? +path[] noble; +numerals.push(noble); From 32a940467f9adb5c7f7ec7e0e6a1a4f065e0154c Mon Sep 17 00:00:00 2001 From: xenofem Date: Wed, 27 Jul 2022 02:53:21 -0400 Subject: [PATCH 02/11] shell script for getting asy paths from font glyph data --- glif2asy.sh | 3 +++ 1 file changed, 3 insertions(+) create mode 100755 glif2asy.sh diff --git a/glif2asy.sh b/glif2asy.sh new file mode 100755 index 0000000..a088ead --- /dev/null +++ b/glif2asy.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +sd -f m '(\n| )*' '^^' | sd -f m '(.|\n)+' '' | sd -f m '(.|\n)+' '' | sd '^ +' '' | sd -f m '\n\n' '..controls ($1,$2) and ($3,$4)..' | sd '' '($1,$2)' | sd -- '' '---($1,$2)' | sd -- '' '--($1,$2)' | tr -d '\n' From 24cca82e6ef78b6136a2c001a8e3129c5ef8e6c0 Mon Sep 17 00:00:00 2001 From: xenofem Date: Wed, 27 Jul 2022 02:53:37 -0400 Subject: [PATCH 03/11] use Fanwood font for numerals --- numerals.asy | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/numerals.asy b/numerals.asy index ffe7965..c2413ec 100644 --- a/numerals.asy +++ b/numerals.asy @@ -7,34 +7,38 @@ int NOBLE = 10; path numerals[][] = { {} }; -path onearc = arc((0,height*0.4), height*0.1, 0, 180); -path[] one = { onearc--(rotate(180)*onearc)--cycle }; +real glyph_height = 690; +real face_letter_scale_adjustment = 0.8; + + +// Glyphs from https://github.com/theleagueof/fanwood +path[] one = { scale(height/glyph_height)*shift(-(363+150)/2, -glyph_height/2)*((150,589)..controls (150,586) and (149,583)..(156,583)..controls (160,583) and (219,588)..(224,588)..controls (234,588) and (234,585)..(235,568)..controls (237,511) and (239,345)..(239,228)---(239,110)..controls (239,85) and (239,27)..(235,27)---(171,27)..controls (155,27) and (153,27)..(153,15)..controls (153,-2) and (154,-3)..(167,-3)..controls (190,-3) and (246,0)..(276,0)..controls (306,0) and (347,-3)..(363,-3)..controls (373,-3) and (374,-1)..(374,14)..controls (374,26) and (374,27)..(363,27)---(317,27)..controls (309,27) and (309,43)..(309,66)..controls (309,250) and (310,406)..(310,604)..controls (310,616) and (310,619)..(303,619)..controls (297,619) and (200,613)..(160,610)..controls (151,609) and (150,610)..(150,602)---cycle) }; numerals.push(one); -path[] two = { shift(width/4, 0)*one[0], shift(-width/4, 0)*one[0] }; +path[] two = { scale(height/glyph_height)*shift(-(40+458)/2, -glyph_height/2)*((40,493)..controls (40,486) and (55,478)..(61,478)..controls (66,478) and (121,574)..(219,574)..controls (300,574) and (338,496)..(338,428)..controls (338,280) and (181,166)..(127,117)..controls (122,113) and (66,17)..(66,11)..controls (66,5) and (69,0)..(80,0)---(426,0)..controls (433,0) and (436,1)..(437,6)..controls (445,45) and (458,132)..(458,139)..controls (458,142) and (442,142)..(437,142)..controls (433,142) and (423,58)..(419,58)---(127,58)..controls (122,58) and (120,58)..(120,59)..controls (120,61) and (136,96)..(153,110)..controls (211,156) and (413,300)..(413,447)..controls (413,518) and (360,622)..(238,622)..controls (126,622) and (40,508)..cycle) }; numerals.push(two); -path[] three; +path[] three = { scale(height/glyph_height)*shift(-(90+394)/2, -glyph_height/2)*((90,17)..controls (90,-12) and (175,-18)..(226,-18)..controls (330,-18) and (437,59)..(437,175)..controls (437,288) and (366,320)..(280,326)..controls (251,328) and (236,326)..(236,329)..controls (236,331) and (259,339)..(286,351)..controls (341,376) and (394,431)..(394,502)..controls (394,577) and (330,633)..(244,633)..controls (161,633) and (92,569)..(92,556)..controls (92,548) and (103,538)..(111,538)..controls (117,538) and (157,599)..(228,599)..controls (282,599) and (325,546)..(325,492)..controls (325,392) and (269,350)..(160,324)..controls (149,321) and (139,322)..(139,310)..controls (139,307) and (140,301)..(141,298)..controls (144,289) and (142,281)..(154,281)..controls (163,281) and (214,286)..(240,286)..controls (331,286) and (373,242)..(373,158)..controls (373,76) and (324,8)..(237,8)..controls (217,8) and (188,21)..(167,34)..controls (151,43) and (148,47)..(130,47)..controls (109,47) and (90,27)..cycle) }; numerals.push(three); -path[] four; +path[] four = scale(height/glyph_height)*shift(-(40+444)/2, -glyph_height/2)*((40,209)..controls (40,202) and (50,201)..(58,201)---(277,201)..controls (292,201) and (293,201)..(293,186)---(290,2)..controls (290,-6) and (290,-11)..(295,-11)..controls (310,-11) and (350,-9)..(356,-7)..controls (359,-6) and (360,-5)..(360,2)..controls (360,7) and (359,126)..(356,187)..controls (355,201) and (356,201)..(370,201)---(432,201)..controls (444,201) and (444,201)..(444,211)---(444,245)..controls (444,255) and (443,255)..(437,255)---(369,255)..controls (355,255) and (354,255)..(354,273)---(354,599)..controls (354,618) and (351,628)..(343,628)..controls (335,628) and (320,610)..(299,590)..controls (288,580) and (274,577)..(260,559)..controls (193,472) and (98,337)..(56,264)..controls (41,238) and (40,220)..cycle^^(87,259)..controls (87,264) and (95,274)..(100,281)..controls (145,346) and (282,544)..(290,544)..controls (293,544) and (293,537)..(293,518)---(293,275)..controls (293,256) and (292,255)..(274,255)---(107,255)..controls (92,255) and (87,255)..cycle); numerals.push(four); -path[] five = { (0,-height*0.3)---(width*0.45,height/2)..(width/2, height*0.45)---(height*0.1, -height*0.45)..(-height*0.1, -height*0.45)---(-width/2, height*0.45)..(-width*0.45,height/2)--cycle }; +path[] five = { scale(height/glyph_height)*shift(-(100+409)/2, -glyph_height/2)*((100,-18)..controls (100,-29) and (102,-34)..(108,-34)..controls (143,-34) and (408,-11)..(408,198)..controls (408,353) and (304,392)..(183,392)..controls (171,392) and (160,392)..(149,391)..controls (141,391) and (138,394)..(138,402)..controls (138,409) and (150,534)..(152,551)..controls (153,560) and (152,559)..(162,558)..controls (233,551) and (294,546)..(372,546)..controls (398,546) and (405,548)..(406,563)..controls (407,588) and (409,627)..(409,631)..controls (409,639) and (409,640)..(399,640)---(391,640)..controls (385,640) and (380,640)..(380,635)..controls (379,625) and (379,607)..(374,607)..controls (208,607) and (150,618)..(145,618)..controls (139,618) and (130,618)..(129,612)..controls (119,532) and (102,361)..(102,347)..controls (102,338) and (106,337)..(116,337)..controls (126,337) and (135,338)..(145,338)..controls (241,338) and (342,312)..(342,194)..controls (342,8) and (183,7)..(108,-4)..controls (102,-5) and (100,-10)..cycle) }; numerals.push(five); -path[] six; +path[] six = scale(height/glyph_height)*shift(-(45+440)/2, -glyph_height/2)*((45,218)..controls (45,48) and (137,-22)..(249,-22)..controls (357,-22) and (440,54)..(440,171)..controls (440,284) and (363,352)..(252,352)..controls (210,352) and (172,342)..(143,333)..controls (134,330) and (131,327)..(131,332)..controls (131,339) and (139,361)..(141,367)..controls (174,453) and (230,527)..(354,599)..controls (366,606) and (374,608)..(374,616)..controls (374,620) and (364,637)..(360,637)..controls (344,637) and (45,514)..cycle^^(116,222)..controls (116,248) and (119,276)..(124,297)..controls (126,305) and (131,307)..(153,313)..controls (179,320) and (205,322)..(228,322)..controls (314,322) and (371,278)..(371,158)..controls (371,81) and (331,4)..(258,4)..controls (146,4) and (116,110)..cycle); numerals.push(six); -path[] traveler; -numerals.push(traveler); +path[] traveler_glyph = { scale(face_letter_scale_adjustment*height/glyph_height)*shift(-(20+670)/2, -glyph_height/2)*((20,544)..controls (20,535) and (30,535)..(40,535)..controls (49,535) and (52,539)..(53,552)---(60,622)..controls (61,633) and (105,635)..(157,635)---(301,635)..controls (307,635) and (308,594)..(308,545)..controls (308,436) and (304,27)..(294,27)---(232,27)..controls (216,27) and (214,27)..(214,15)..controls (214,-2) and (215,-3)..(228,-3)..controls (251,-3) and (319,0)..(349,0)..controls (379,0) and (446,-3)..(469,-3)..controls (479,-3) and (480,-1)..(480,14)..controls (480,26) and (480,27)..(469,27)---(395,27)..controls (393,27) and (393,53)..(393,92)..controls (393,217) and (399,474)..(399,477)..controls (400,534) and (399,635)..(409,635)---(525,635)..controls (582,635) and (638,633)..(638,627)..controls (638,621) and (635,554)..(635,549)..controls (635,539) and (638,535)..(650,535)..controls (664,535) and (666,537)..(666,545)..controls (666,623) and (670,656)..(670,675)..controls (670,685) and (667,686)..(653,686)..controls (645,686) and (641,684)..(640,674)..controls (639,664) and (589,663)..(531,663)---(174,663)..controls (121,663) and (66,663)..(66,669)---(66,680)..controls (66,686) and (61,686)..(53,686)..controls (38,686) and (38,685)..(37,672)..controls (33,622) and (20,546)..cycle) }; +numerals.push(traveler_glyph); -path[] knight; -numerals.push(knight); +path[] knight_glyph = { scale(face_letter_scale_adjustment*height/glyph_height)*shift(-(40+650)/2, -glyph_height/2)*((40,15)..controls (40,-2) and (41,-3)..(54,-3)..controls (77,-3) and (139,0)..(169,0)..controls (199,0) and (266,-3)..(289,-3)..controls (299,-3) and (300,-1)..(300,14)..controls (300,26) and (300,27)..(289,27)---(216,27)..controls (205,27) and (205,172)..(205,298)..controls (205,310) and (207,310)..(219,310)---(239,310)..controls (254,310) and (254,310)..(261,302)---(478,45)..controls (484,38) and (490,34)..(490,31)..controls (490,29) and (486,27)..(473,27)---(443,27)..controls (427,27) and (425,27)..(425,15)..controls (425,-2) and (426,-3)..(439,-3)..controls (462,-3) and (509,0)..(539,0)..controls (569,0) and (616,-3)..(639,-3)..controls (649,-3) and (650,-1)..(650,14)..controls (650,26) and (650,27)..(639,27)---(625,27)..controls (611,27) and (603,34)..(594,44)---(325,354)..controls (315,366) and (312,365)..(322,376)..controls (380,445) and (537,634)..(538,634)---(587,634)..controls (603,634) and (605,634)..(605,646)..controls (605,663) and (604,664)..(591,664)..controls (568,664) and (541,661)..(511,661)..controls (481,661) and (442,664)..(426,664)..controls (413,664) and (406,664)..(406,649)..controls (406,634) and (414,634)..(426,634)---(463,634)..controls (474,634) and (478,632)..(478,629)..controls (478,625) and (474,620)..(469,613)..controls (432,566) and (265,331)..(240,331)---(218,331)..controls (206,331) and (205,337)..(205,351)---(205,476)..controls (205,532) and (209,634)..(219,634)---(273,634)..controls (289,634) and (291,634)..(291,646)..controls (291,663) and (290,664)..(277,664)..controls (254,664) and (201,661)..(171,661)..controls (141,661) and (85,664)..(69,664)..controls (56,664) and (49,664)..(49,649)..controls (49,634) and (57,634)..(69,634)---(113,634)..controls (120,634) and (121,559)..(121,487)---(121,197)..controls (121,105) and (120,27)..(113,27)---(58,27)..controls (42,27) and (40,27)..cycle) }; +numerals.push(knight_glyph); -path[] wizard; -numerals.push(wizard); +path[] wizard_glyph = { scale(face_letter_scale_adjustment*height/glyph_height)*shift(-(10+887)/2, -glyph_height/2)*((10,649)..controls (10,634) and (18,634)..(30,634)---(65,634)..controls (72,634) and (225,116)..(227,110)..controls (253,32) and (261,-25)..(279,-25)..controls (292,-25) and (299,-4)..(320,26)..controls (331,42) and (337,43)..(347,68)---(489,440)..controls (495,456) and (498,465)..(501,465)..controls (504,465) and (506,457)..(511,440)..controls (553,293) and (602,113)..(603,110)..controls (629,32) and (637,-25)..(655,-25)..controls (668,-25) and (675,-4)..(696,26)..controls (707,42) and (713,43)..(723,68)---(944,611)..controls (952,629) and (953,634)..(980,634)..controls (996,634) and (998,636)..(998,648)..controls (998,662) and (997,664)..(984,664)..controls (974,664) and (946,661)..(916,661)..controls (886,661) and (829,664)..(813,664)..controls (800,664) and (796,664)..(796,649)..controls (796,634) and (801,634)..(813,634)---(878,634)..controls (886,634) and (887,628)..(887,618)..controls (887,567) and (773,276)..(722,140)..controls (709,107) and (704,90)..(700,90)..controls (695,90) and (692,108)..(681,142)..controls (675,163) and (609,386)..(571,526)..controls (568,538) and (553,601)..(553,625)..controls (553,630) and (554,634)..(556,634)---(620,634)..controls (633,634) and (637,634)..(637,646)..controls (637,663) and (636,664)..(623,664)..controls (600,664) and (533,661)..(503,661)..controls (473,661) and (408,664)..(392,664)..controls (379,664) and (375,664)..(375,649)..controls (375,634) and (380,634)..(392,634)---(452,634)..controls (454,634) and (466,602)..(479,556)..controls (483,540) and (488,533)..(488,525)..controls (488,520) and (486,515)..(483,507)---(340,142)..controls (331,118) and (327,106)..(324,106)..controls (321,106) and (319,118)..(311,142)..controls (305,162) and (233,380)..(190,526)..controls (187,536) and (163,620)..(163,625)..controls (163,634) and (171,634)..(173,634)---(223,634)..controls (239,634) and (241,634)..(241,646)..controls (241,663) and (240,664)..(227,664)..controls (204,664) and (153,661)..(123,661)..controls (93,661) and (46,664)..(30,664)..controls (17,664) and (10,664)..cycle) }; +numerals.push(wizard_glyph); // Is this even the same across suits? or is it like, *C*ount of Cards, *Q*ueen of Puppets, ??? of Bread, etc? -path[] noble; -numerals.push(noble); +path[] noble_glyph = { scale(face_letter_scale_adjustment*height/glyph_height)*shift(-(40+774)/2, -glyph_height/2)*((40,15)..controls (40,-2) and (41,-3)..(54,-3)..controls (77,-3) and (106,0)..(136,0)..controls (166,0) and (219,-3)..(242,-3)..controls (252,-3) and (253,-1)..(253,14)..controls (253,26) and (253,27)..(242,27)---(156,27)..controls (153,27) and (151,68)..(151,129)..controls (151,224) and (152,366)..(152,472)..controls (152,525) and (152,569)..(153,594)..controls (153,609) and (154,614)..(156,614)..controls (159,614) and (164,606)..(172,596)---(664,-2)..controls (670,-9) and (677,-18)..(682,-18)..controls (687,-18) and (692,-12)..(692,4)..controls (692,15) and (704,425)..(705,580)..controls (705,617) and (708,639)..(709,639)---(756,639)..controls (772,639) and (774,639)..(774,651)..controls (774,668) and (773,669)..(760,669)..controls (737,669) and (708,666)..(678,666)..controls (648,666) and (595,669)..(572,669)..controls (562,669) and (561,667)..(561,652)..controls (561,640) and (561,639)..(572,639)---(666,639)..controls (667,639) and (667,617)..(667,583)..controls (667,482) and (669,305)..(669,207)---(669,165)..controls (669,145) and (668,137)..(665,137)..controls (662,137) and (656,146)..(647,157)---(241,656)..controls (233,666) and (232,669)..(221,669)..controls (215,669) and (188,666)..(166,666)..controls (145,666) and (68,669)..(54,669)..controls (44,669) and (43,667)..(43,652)..controls (43,640) and (43,639)..(54,639)--(122,639)..controls (122,639) and (119,301)..(114,129)..controls (112,68) and (115,27)..(102,27)---(58,27)..controls (42,27) and (40,27)..cycle) }; +numerals.push(noble_glyph); From ddf019831d9425c0057ec46fecc80193ed0ef49f Mon Sep 17 00:00:00 2001 From: xenofem Date: Wed, 27 Jul 2022 02:53:46 -0400 Subject: [PATCH 04/11] ignore pngs --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 6131751..8c58437 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -*.svg \ No newline at end of file +*.svg +*.png \ No newline at end of file From 1968179837af68bb6e378d33bbaabe00f57a4daa Mon Sep 17 00:00:00 2001 From: xenofem Date: Wed, 27 Jul 2022 02:54:04 -0400 Subject: [PATCH 05/11] reduce wheel radius --- wheels.asy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wheels.asy b/wheels.asy index e7c574b..04e5053 100644 --- a/wheels.asy +++ b/wheels.asy @@ -5,7 +5,7 @@ import "scaling.asy" as scaling; //path bread = (x,0){right}..{up}(width, height-y){up}..{left}(width-x, height){left}..{down}(0,y){down}..{right}cycle; -real outer_radius = height/2; +real outer_radius = height*0.42; real inner_radius = outer_radius*4/5; real center_radius = outer_radius/5; real axle_radius = center_radius/2; From 974bb1e4cc832f6f3a17ecc62b99d3c56901f2e0 Mon Sep 17 00:00:00 2001 From: xenofem Date: Wed, 27 Jul 2022 02:54:27 -0400 Subject: [PATCH 06/11] blades not swords --- swords.asy | 28 ---------------------------- 1 file changed, 28 deletions(-) delete mode 100644 swords.asy diff --git a/swords.asy b/swords.asy deleted file mode 100644 index e7c574b..0000000 --- a/swords.asy +++ /dev/null @@ -1,28 +0,0 @@ -import "scaling.asy" as scaling; - -//real x = width/3; -//real y = 2*height/6; - -//path bread = (x,0){right}..{up}(width, height-y){up}..{left}(width-x, height){left}..{down}(0,y){down}..{right}cycle; - -real outer_radius = height/2; -real inner_radius = outer_radius*4/5; -real center_radius = outer_radius/5; -real axle_radius = center_radius/2; - -int gaps = 6; -real spoke_width = center_radius*0.7; - -path spoke_part = (spoke_width/2, 0)--(spoke_width/2, outer_radius); - -path gap = buildcycle(circle((0,0), center_radius), spoke_part, reverse(circle((0,0), inner_radius)), reflect((0,0), dir(90-180/gaps))*spoke_part); - -//draw((-width/2,-height/2)--(width/2,-height/2)--(width/2,height/2)--(-width/2,height/2)--cycle); - -path wheel[] = { circle((0,0), outer_radius), circle((0,0), axle_radius) }; - -for (int i = 0; i < gaps; ++i) { - wheel = wheel^^(rotate(360*i/gaps)*gap); -} - -//fill(wheel, evenodd+red); From 342c9a146ea0fdd2d55e5fa5f4e4e0ea46ec47f9 Mon Sep 17 00:00:00 2001 From: xenofem Date: Wed, 27 Jul 2022 02:54:49 -0400 Subject: [PATCH 07/11] put an asymmetrical object in blades to make sure rotation is good --- blades.asy | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/blades.asy b/blades.asy index e7c574b..bab5352 100644 --- a/blades.asy +++ b/blades.asy @@ -1,28 +1,3 @@ import "scaling.asy" as scaling; -//real x = width/3; -//real y = 2*height/6; - -//path bread = (x,0){right}..{up}(width, height-y){up}..{left}(width-x, height){left}..{down}(0,y){down}..{right}cycle; - -real outer_radius = height/2; -real inner_radius = outer_radius*4/5; -real center_radius = outer_radius/5; -real axle_radius = center_radius/2; - -int gaps = 6; -real spoke_width = center_radius*0.7; - -path spoke_part = (spoke_width/2, 0)--(spoke_width/2, outer_radius); - -path gap = buildcycle(circle((0,0), center_radius), spoke_part, reverse(circle((0,0), inner_radius)), reflect((0,0), dir(90-180/gaps))*spoke_part); - -//draw((-width/2,-height/2)--(width/2,-height/2)--(width/2,height/2)--(-width/2,height/2)--cycle); - -path wheel[] = { circle((0,0), outer_radius), circle((0,0), axle_radius) }; - -for (int i = 0; i < gaps; ++i) { - wheel = wheel^^(rotate(360*i/gaps)*gap); -} - -//fill(wheel, evenodd+red); +path blade[] = { scale(width)*(dir(-30)--dir(90)--dir(210)--cycle) }; From 1d22d75da6ee346845a6245311130f46806d8cc0 Mon Sep 17 00:00:00 2001 From: xenofem Date: Wed, 27 Jul 2022 02:55:21 -0400 Subject: [PATCH 08/11] tweak card layout - placements, rotation, sizing, radius, etc --- cards.asy | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/cards.asy b/cards.asy index e8d1022..7f9ace8 100644 --- a/cards.asy +++ b/cards.asy @@ -6,7 +6,7 @@ import "blades.asy" as blades_suit; import "wheels.asy" as wheels_suit; import "numerals.asy" as numerals_paths; -real corner_radius = width/10; +real corner_radius = width/12; path corner = arc(((width/2 - corner_radius), (height/2 - corner_radius)), corner_radius, 0, 90); @@ -15,27 +15,27 @@ path card = corner--reverse(reflect((0,0), (0,1))*corner)--rotate(180)*corner--r real scpx = 0.2; real scpy = 0.35; -pair placements[][] = { +transform placements[][] = { // 0 {}, // 1 - { (0,0) }, + { identity }, // 2 - { (0,height*scpy), (0,-height*scpy) }, + { shift(0,height*scpy), shift(0,-height*scpy)*rotate(180) }, // 3 - { (0,0), (0,height*scpy), (0,-height*scpy) }, + { identity, shift(0,height*scpy), shift(0,-height*scpy)*rotate(180) }, // 4 - { (width*scpx,height*scpy), (width*scpx,-height*scpy), (-width*scpx,height*scpy), (-width*scpx,-height*scpy) }, + { shift(width*scpx,height*scpy), shift(width*scpx,-height*scpy)*rotate(180), shift(-width*scpx,height*scpy), shift(-width*scpx,-height*scpy)*rotate(180) }, // 5 - { (0,0), (width*scpx,height*scpy), (width*scpx,-height*scpy), (-width*scpx,height*scpy), (-width*scpx,-height*scpy) }, + { identity, shift(width*scpx,height*scpy), shift(width*scpx,-height*scpy)*rotate(180), shift(-width*scpx,height*scpy), shift(-width*scpx,-height*scpy)*rotate(180) }, // 6 - { (width*scpx,0), (-width*scpx,0), (width*scpx,height*scpy), (width*scpx,-height*scpy), (-width*scpx,height*scpy), (-width*scpx,-height*scpy) }, + { shift(width*scpx,0), shift(-width*scpx,0), shift(width*scpx,height*scpy), shift(width*scpx,-height*scpy)*rotate(180), shift(-width*scpx,height*scpy), shift(-width*scpx,-height*scpy)*rotate(180) }, // The four face cards {}, {}, {}, {}, @@ -53,12 +53,12 @@ pair placements[][] = { }; real scale_factor = 0.15; -real one_scale_factor = 0.3; +real one_scale_factor = 0.4; real numeral_scale_factor = 0.15; -pair numeral_pos = (-width*0.39, height*0.37); +pair numeral_pos = (-width*0.38, height*0.4); real indicator_scale_factor = 0.1; -pair indicator_pos = (-width*0.39, height*0.22); +pair indicator_pos = (-width*0.38, height*0.25); int PUPPETS = 0; int BREAD = 1; @@ -68,14 +68,16 @@ int WHEELS = 4; int CARDS = 5; path icons[][] = { - null, + {}, bread, - null, - null, + {}, + blade, wheel, }; -path[] recursive_card(int value, int suit, int depth=3, bool outermost=true) { +// note: if you bump this depth value to 4, you'll need to set +// buf_size=5000000 so latex doesn't choke +path[] recursive_card(int value, int suit, int depth=4, bool outermost=true) { path result[]; if (!outermost) { result.push(card); @@ -96,11 +98,11 @@ path[] recursive_card(int value, int suit, int depth=3, bool outermost=true) { current_scale_factor = one_scale_factor; } for(int i = 0; i < placements[value].length; ++i) { - result = result^^(shift(placements[value][i])*scale(current_scale_factor)*suit_icon); + result = result^^(placements[value][i]*scale(current_scale_factor)*suit_icon); } return result; } -filldraw(card, white, black); -fill(recursive_card(2, BREAD), evenodd+red); +//filldraw(card, white, black); +//fill(recursive_card(6, BLADES), evenodd+red); From 3efdefba9e8550a4f4092b21aa89a3e23af83721 Mon Sep 17 00:00:00 2001 From: xenofem Date: Wed, 27 Jul 2022 02:55:41 -0400 Subject: [PATCH 09/11] add asy file to generate the whole deck --- deck.asy | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 deck.asy diff --git a/deck.asy b/deck.asy new file mode 100644 index 0000000..2aa9af8 --- /dev/null +++ b/deck.asy @@ -0,0 +1,33 @@ +import "cards.asy" as cards; +import "numerals.asy" as numerals; + +for (int suit = 0; suit <= 5; ++suit) { + for (int value = 1; value <= 10; ++value) { + currentpicture = new picture; + filldraw(card, white, black); + + if (suit == CARDS && value == 1) { + // due to exponential growth, with the larger suit icon on the 1 + // card, the endpoint of the recursion is a *lot* more visible + fill(recursive_card(value, suit, 6), evenodd+red); + } else { + fill(recursive_card(value, suit), evenodd+red); + } + + string suit_str; + if (suit == PUPPETS) { suit_str = "puppets"; } + else if (suit == BREAD) { suit_str = "bread"; } + else if (suit == WHEELS) { suit_str = "wheels"; } + else if (suit == BLADES) { suit_str = "blades"; } + else if (suit == CHAIRS) { suit_str = "chairs"; } + else { suit_str = "cards"; } + + string value_str; + if (value == TRAVELER) { value_str = "traveler"; } + else if (value == KNIGHT) { value_str = "knight"; } + else if (value == WIZARD) { value_str = "wizard"; } + else if (value == NOBLE) { value_str = "noble"; } + else { value_str = format("%d", value); } + shipout(value_str+"-"+suit_str, "svg"); + } +} From b448cb78eb1a80428bb64014d6e1f6b2c8c599b7 Mon Sep 17 00:00:00 2001 From: xenofem Date: Wed, 27 Jul 2022 02:56:05 -0400 Subject: [PATCH 10/11] add asy file to generate single card for testing --- single-card.asy | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 single-card.asy diff --git a/single-card.asy b/single-card.asy new file mode 100644 index 0000000..5cef1c6 --- /dev/null +++ b/single-card.asy @@ -0,0 +1,14 @@ +import "cards.asy" as cards; +import "numerals.asy" as numerals; + +int suit = WHEELS; +int value = 1; +filldraw(card, white, black); + +if (suit == CARDS && value == 1) { + // due to exponential growth, with the larger suit icon on the 1 + // card, the endpoint of the recursion is a *lot* more visible + fill(recursive_card(value, suit, 6), evenodd+red); +} else { + fill(recursive_card(value, suit), evenodd+red); +} From c799a4d4950a9f0ccf54d2872f35ace57d2f5727 Mon Sep 17 00:00:00 2001 From: xenofem Date: Wed, 27 Jul 2022 02:57:13 -0400 Subject: [PATCH 11/11] remove drawing commands from cards.asy --- cards.asy | 4 ---- 1 file changed, 4 deletions(-) diff --git a/cards.asy b/cards.asy index 7f9ace8..15b2a56 100644 --- a/cards.asy +++ b/cards.asy @@ -102,7 +102,3 @@ path[] recursive_card(int value, int suit, int depth=4, bool outermost=true) { } return result; } - -//filldraw(card, white, black); -//fill(recursive_card(6, BLADES), evenodd+red); -