This is the general case the sphere, the cylinder, and the cone are special
cases of — they are written out separately because their analytic normals are
exact and their option names are the ones a caller reaches for, not because
they are different machines.
Normals come from the profile, not from the faces: at profile point i
the tangent is the central difference P[i+1] − P[i−1] (one-sided at the
ends), and the outward normal in the (r, y) half-plane is that tangent
turned a quarter turn, (tangent.y, −tangent.x). Revolved, that gives
(n_r·cos θ, n_y, n_r·sin θ). Feeding a circular arc in therefore reproduces
the sphere's exact radial normals, which is the property the tests check —
except at the two end rings, where the difference is necessarily
one-sided and the normal leans by half a segment. That is visible only if a
profile ends on a silhouette; sphereGeometry exists partly so the one
shape where it would matter has analytic normals instead.
A profile point with x = 0 is a pole: its ring collapses and the quads
touching it degenerate, exactly as at a sphere's poles. Negative radii are
rejected (§85) — they turn the surface inside out rather than doing anything
useful. Uv is u around and v = i / (points.length − 1) along the profile,
so v = 0 is the first point given.
A surface of revolution: the
pointsprofile revolved a full turn about the +Y axis (§53 "lathe").This is the general case the sphere, the cylinder, and the cone are special cases of — they are written out separately because their analytic normals are exact and their option names are the ones a caller reaches for, not because they are different machines.
Normals come from the profile, not from the faces: at profile point
ithe tangent is the central differenceP[i+1] − P[i−1](one-sided at the ends), and the outward normal in the(r, y)half-plane is that tangent turned a quarter turn,(tangent.y, −tangent.x). Revolved, that gives(n_r·cos θ, n_y, n_r·sin θ). Feeding a circular arc in therefore reproduces the sphere's exact radial normals, which is the property the tests check — except at the two end rings, where the difference is necessarily one-sided and the normal leans by half a segment. That is visible only if a profile ends on a silhouette; sphereGeometry exists partly so the one shape where it would matter has analytic normals instead.A profile point with
x = 0is a pole: its ring collapses and the quads touching it degenerate, exactly as at a sphere's poles. Negative radii are rejected (§85) — they turn the surface inside out rather than doing anything useful. Uv isuaround andv = i / (points.length − 1)along the profile, sov = 0is the first point given.