prism function
Implementation
GemSolid prism({
double r = 4.6,
double half = 5.5,
double top = 7.5,
double bottom = 6.0,
int n = 6,
}) {
final planes = <GemPlane>[];
final ct = math.atan2(top, r);
final cb = math.atan2(bottom, r);
for (var i = 0; i < n; i++) {
final a = (i * tau) / n;
planes.add(GemPlane([math.cos(a), 0.0, math.sin(a)], r, 6));
planes.add(GemPlane(
[math.sin(ct) * math.cos(a), math.cos(ct), math.sin(ct) * math.sin(a)],
math.sin(ct) * r + math.cos(ct) * half,
7,
));
planes.add(GemPlane(
[math.sin(cb) * math.cos(a), -math.cos(cb), math.sin(cb) * math.sin(a)],
math.sin(cb) * r + math.cos(cb) * half,
8,
));
}
return GemSolid(
planes: planes,
r: r / math.cos(math.pi / n),
top: half + top,
bottom: half + bottom,
);
}