Ana Tudor 🐯 on Nostr: Also #tinyCodingTip: random uniform sphere surface distribution with polar ...
Also #tinyCodingTip: random uniform sphere surface distribution with polar coordinates!
u = rand(0, 1)
v = rand(0, 1)
❌ DON'T (pole clusters)
θ = 2·π·u
φ = v·π - π/2
✅ DO
θ = 2·π·u
φ = acos(2·v - 1) - π/2
➞x,y,z
x = r·cos(φ)·sin(θ)
y = r·sin(φ)
z = r·cos(φ)·cos(θ)
Pure CSS illustration of concept 😼
https://codepen.io/thebabydino/pen/yLzxdjj
#CSS #CodePen #3D #maths #geometry #mathematics #coding #frontend #webDev #webDevelopment #distribution
u = rand(0, 1)
v = rand(0, 1)
❌ DON'T (pole clusters)
θ = 2·π·u
φ = v·π - π/2
✅ DO
θ = 2·π·u
φ = acos(2·v - 1) - π/2
➞x,y,z
x = r·cos(φ)·sin(θ)
y = r·sin(φ)
z = r·cos(φ)·cos(θ)
Pure CSS illustration of concept 😼
https://codepen.io/thebabydino/pen/yLzxdjj
#CSS #CodePen #3D #maths #geometry #mathematics #coding #frontend #webDev #webDevelopment #distribution