3 ms·
There's a link to https://github.com/cdiggins/heron-language/blob/master/input/geometry-mesh.heron https://github.com/cdiggins/heron-language/blob/master/input.
by yorwba 9y ago
There's a link to https://github.com/cdiggins/heron-language/blob/master/input/geometry-mesh.heron https://github.com/cdiggins/heron-language/blob/master/input... on the demo page, where you can see that the sphere is implemented like this:
// Given UV coordinates on the surface of a sphere u=[0,1), v=[0,1) computes the 3D location.
function spherePoint(u, v)
= vector(-cos(u*2.0*pi) * sin(v*2.0*pi), cos(v*2.0*pi), sin(u*2.0*pi) * sin(v*2.0*pi));
function sphere(segments)
= meshFromUV(spherePoint, segments);
function sphere()
= sphere(32);