Java, 881 bytes
import java.awt.image.BufferedImage;import static java.lang.Math.*;class J{BufferedImage o=new BufferedImage(999,999,1);java.awt.Graphics g=o.getGraphics();double v=2.5132,w=1.2566,p=PI,s=(p-v)/2,u=(p+w)/2;public static void main(String[]v){new J(Integer.parseInt(v[0]));}J(int i){d(609,391,v,p/4+s,500,i);try{javax.imageio.ImageIO.write(o,"png",new java.io.File("a.png"));}catch(Exception e){}}void d(int x,int y,double o,double q,double l,int r){int m=(int)(2*l*sin((p-o)/2)),a=(int)(x+cos(q)*l),b=(int)(y+sin(q)*l),c=(int)(x+cos(q+o/2)*m),d=(int)(y+sin(q+o/2)*m),e=(int)(x+cos(q+o)*l),f=(int)(y+sin(q+o)*l);if(r-->0){double n=l/(2*sin((v)/2));if(o>w){d(x,y,v,q-s,n,r);d(c,d,v,q+p+s,n,r);d(a,b,w,q+u,n,r);}else{d(x,y,w,q-s,n,r);d(c,d,w,q+p+s,n,r);d(e,f,w,q-p/2,n,r);d(a,b,v,q+p/2-s-s,n,r);}}else{g.drawLine(x,y,a,b);g.drawLine(a,b,c,d);g.drawLine(x,y,e,f);g.drawLine(c,d,e,f);}}}
Ungolfed
import java.awt.image.BufferedImage;
import static java.lang.Math.*;
class Q79373 {
BufferedImage image = new BufferedImage(999, 999, 1);
java.awt.Graphics graphics = image.getGraphics();
double aRad = 2.5132, bRad = 1.2566, pi = PI, aAcuteHalf = (pi - aRad) / 2, bRadHalfPi = (pi + bRad) / 2;
public static void main(String[] v) {
new Q79373(Integer.parseInt(v[0]));
}
Q79373(int i) {
draw(609, 391, aRad, pi / 4 + aAcuteHalf, 500, i);
try {
javax.imageio.ImageIO.write(image, "png", new java.io.File("a.png"));
} catch (Exception e) {
}
}
void draw(int x, int y, double rad, double rot, double length, int recDepth) {
int
height = (int) (2 * length * sin((pi - rad) / 2)),
a = (int) (x + cos(rot) * length),
b = (int) (y + sin(rot) * length),
c = (int) (x + cos(rot + rad / 2) * height),
d = (int) (y + sin(rot + rad / 2) * height),
e = (int) (x + cos(rot + rad) * length),
f = (int) (y + sin(rot + rad) * length);
if (recDepth-- > 0) {
double lengthNew = length / (2 * sin((aRad) / 2));
if (rad > bRad) {
draw(x, y, aRad, rot - aAcuteHalf, lengthNew, recDepth);
draw(c, d, aRad, rot + pi + aAcuteHalf, lengthNew, recDepth);
draw(a, b, bRad, rot + bRadHalfPi, lengthNew, recDepth);
} else {
draw(x, y, bRad, rot - aAcuteHalf, lengthNew, recDepth);
draw(c, d, bRad, rot + pi + aAcuteHalf, lengthNew, recDepth);
draw(e, f, bRad, rot - pi / 2, lengthNew, recDepth);
draw(a, b, aRad, rot + pi / 2 - aAcuteHalf - aAcuteHalf, lengthNew, recDepth);
}
} else {
graphics.drawLine(x, y, a, b);
graphics.drawLine(a, b, c, d);
graphics.drawLine(x, y, e, f);
graphics.drawLine(c, d, e, f);
}
}
}
Notes
The results arent 100% acurate thanks to integer precision. I used integers for the coordinates because Graphics::drawLine
only takes integers as arguments, and I would've ended up with way more integer casts than I have now.
I'll probably golf a bit more later, still not optimal.
Results
Full image filled
Recursion 1
Recursion 2
Recursion 3
n=2
example for the second level of substitution, no? In the substitution, two A rhombi are attached to a corner. In your example, one B rhombus is attached to a corner. \$\endgroup\$n=2
now, but I'm still getting wrongly rotated substitutions forn=3
\$\endgroup\$