Title: Surface Approximation
1Surface Approximation
2Sphere Approximation with Longitude and Latitude
3Conversion between (x, y, z) and(r, f, ?)
f
xrcosfcos? yrcosfsin? zrsinf
4Body
for (var phi-90delta/2 philt90-delta/2
phidelta) var phirradians(phi)
var phir2radians(phidelta) for (var
theta-180.0 thetalt180.0 thetadelta)
var thetarradians(theta) var
thetar2radians(thetadelta)
quad(vec4(Math.cos(thetar) Math.cos(phir),
Math.sin(thetar) Math.cos(phir),
Math.sin(phir), 1.0),
vec4(Math.cos(thetar) Math.cos(phir2),
Math.sin(thetar) Math.cos(phir2),
Math.sin(phir2), 1.0),
vec4(Math.cos(thetar2) Math.cos(phir),
Math.sin(thetar2) Math.cos(phir),
Math.sin(phir), 1.0),
vec4(Math.cos(thetar2) Math.cos(phir2),
Math.sin(thetar2) Math.cos(phir2),
Math.sin(phir2), 1.0))
5Two Poles
var sin_d2Math.sin(radians(90-delta/2)) var
cos_d2 Math.cos(radians(90 - delta / 2)) //
positive pole var pvec4(0.0, 0.0, 1.0, 1.0) for
(var theta-180.0 thetalt180.0 thetadelta)
var thetarradians(theta) var
thetar2radians(thetadelta) triangle(p,
vec4(Math.cos(thetar)cos_d2, Math.sin(thetar)co
s_d2, sin_d2, 1.0),
vec4(Math.cos(thetar2)cos_d2, Math.sin(thetar2)c
os_d2, sin_d2, 1.0)) // negative
pole pvec4(0.0, 0.0, -1.0, 1.0) for (var
theta-180.0 thetalt180.0 thetadelta)
var thetarradians(theta) var
thetar2radians(thetadelta) triangle(p,
vec4(Math.cos(thetar)cos_d2, Math.sin(thetar)co
s_d2, -sin_d2, 1.0),
vec4(Math.cos(thetar2)cos_d2, Math.sin(thetar2)c
os_d2, -sin_d2, 1.0))
6Sphere Approximation from Icosahedron
- Examples
- Geodesic playground dome
- Epcot
- Time Square Ball
7Subdivision Code
function divideTriangle(a, b, c, count) if
( count gt 0 ) var ab
normalize(mix( a, b, 0.5), true) var ac
normalize(mix( a, c, 0.5), true) var
bc normalize(mix( b, c, 0.5), true)
divideTriangle( a,
ab, ac, count - 1 ) divideTriangle( ab,
b, bc, count - 1 ) divideTriangle( bc,
c, ac, count - 1 ) divideTriangle( ab,
bc, ac, count - 1 ) else // draw
triangle at end of recursion triangle(a,
b, c)
8Sphere Approximation from Tetrahedron