Code: Select all
//change as necessary
int repeatX = 5;
int repeatY = 3;
image[] imgs = si();
for (int i = 0; i < imgs.length; i++) {
image img = imgs[i];
//find translation to exactly fit neighbor tiles
float h = img.getScale();
float aspectRatio = img.getAspectScale() * img.getPixelWidth() / img.getPixelHeight();
float w = h * aspectRatio;
print(w+" "+h);
//rotate translation
float angle = img.getAngle();
vec2 right = mv( cos(angle) * w, sin(angle) * w );
vec2 up = mv( -sin(angle) * h, cos(angle) * h );
//duplicate
for (int x = 0; x < repeatX; x++) {
for (int y = 0; y < repeatY; y++) {
if ( x == 0 && y == 0 )
continue;
translate( duplicate( img ), x * right + y * up );
}
}
}