2022-04-27 21:27:03 -04:00
|
|
|
struct transbeamPrefs {
|
|
|
|
real triangleRadius;
|
|
|
|
real borderInset;
|
|
|
|
real circleRadius;
|
|
|
|
real bigBeamRadius;
|
|
|
|
real smallBeamRadius;
|
2022-04-29 15:25:47 -04:00
|
|
|
int beamCount;
|
2022-04-27 21:27:03 -04:00
|
|
|
real beamAngle;
|
|
|
|
real starterBeamAngle;
|
|
|
|
}
|
|
|
|
|
2022-04-29 15:25:47 -04:00
|
|
|
pen transBlue = rgb("55cdfc");
|
|
|
|
pen transPink = rgb("f7a8b8");
|
|
|
|
|
|
|
|
pen bigBeamColor = transPink;
|
|
|
|
pen smallBeamColor = transBlue;
|
2022-04-27 21:27:03 -04:00
|
|
|
|
2022-04-29 15:25:47 -04:00
|
|
|
path borderTriangle = dir(90)--dir(210)--dir(330)--cycle;
|
2022-04-27 21:27:03 -04:00
|
|
|
|
2022-04-29 15:25:47 -04:00
|
|
|
void drawTransbeam(transbeamPrefs prefs) {
|
|
|
|
unravel prefs;
|
2022-04-27 21:27:03 -04:00
|
|
|
|
|
|
|
path outerBorder = scale(triangleRadius)*borderTriangle;
|
|
|
|
fill(outerBorder, white);
|
|
|
|
|
|
|
|
path beam(real angle, real innerRadius, real outerRadius) {
|
|
|
|
return arc((0,0), outerRadius, angle/2, -angle/2)--arc((0,0), innerRadius, -angle/2, angle/2)--cycle;
|
|
|
|
}
|
|
|
|
|
|
|
|
path bigBeam = beam(beamAngle, circleRadius, bigBeamRadius);
|
|
|
|
path smallBeam = beam(beamAngle, circleRadius, smallBeamRadius);
|
|
|
|
|
|
|
|
for (int i = 0; i < beamCount; ++i) {
|
|
|
|
if (i > 0) {
|
|
|
|
fill(rotate(360*i/beamCount)*bigBeam, bigBeamColor);
|
|
|
|
}
|
|
|
|
fill(rotate(360*(i+0.5)/beamCount)*smallBeam, smallBeamColor);
|
|
|
|
}
|
|
|
|
|
|
|
|
pair starterBeamTrianglePoint(real angle) {
|
|
|
|
pair circlePoint = circleRadius*dir(angle);
|
|
|
|
return intersectionpoint(circlePoint--(circlePoint+(triangleRadius,0)), outerBorder);
|
|
|
|
}
|
|
|
|
|
|
|
|
fill(starterBeamTrianglePoint(-starterBeamAngle/2)--arc((0,0), circleRadius, -starterBeamAngle/2, starterBeamAngle/2)--starterBeamTrianglePoint(starterBeamAngle/2)--cycle, bigBeamColor);
|
|
|
|
|
|
|
|
draw(outerBorder, transPink+(2*borderInset));
|
|
|
|
draw(scale(triangleRadius-borderInset)*borderTriangle, transBlue+borderInset);
|
|
|
|
}
|