tweak card layout - placements, rotation, sizing, radius, etc

main
xenofem 2022-07-27 02:55:21 -04:00
parent 342c9a146e
commit 1d22d75da6
1 changed files with 20 additions and 18 deletions

View File

@ -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);