Builtin Library
README.md
mesh.spherical
The point of a sphere at longitude phi and polar angle theta (0 at +Y, pi at -Y), and the outward unit normal there, per element.
Inputs
radius(Number, default 0.5). The sphere's radius, in metres.phi(Number, default 0). The longitude, in radians, from +X toward +Z.theta(Number, default 0). The polar angle, in radians, from +Y.
Outputs
position(Vec3). The point on the sphere.normal(Vec3). The outward unit normal.
local lattice = g.mesh.lattice({ shape = "grid", count = 17, across = 9 })
local at = g.mesh.spherical({ radius = 2, phi = lattice.x * (2 * math.pi), theta = lattice.y * math.pi })
local made = lattice.geometry
made.point.P = at.position
made.point.N = at.normal