disc method
A flat disc of radius at height y facing up (−Y) or down (+Y),
in segments steps; its texture spans it once when natural.
Implementation
void disc(double radius, double y, int segments, {required bool up}) {
final ny = up ? -1.0 : 1.0;
final first = vertexCount;
final (cu, cv) = planar(0, y, 0, 0, ny, 0);
vertex(0, y, 0, 0, ny, 0, cu, cv);
for (var i = 0; i <= segments; i++) {
final a = 2 * math.pi * i / segments;
final x = radius * math.cos(a), z = radius * math.sin(a);
final (u, v) = planar(x, y, z, 0, ny, 0);
vertex(x, y, z, 0, ny, 0, u, v);
}
if (!uv.metres) fitTexture(first, vertexCount);
for (var i = 0; i < segments; i++) {
triangle(first, first + 1 + i, first + 2 + i);
}
}