jen's everyday blog

Points on a sphere

I’ve been avoiding working this out for a while, but I need a way to generate points on a sphere of a certain radius. That’s because my agents are composed of spheres, and I need to set their perceptual fields at points on the outside of the spheres.

It’s easy enough to figure out the general formula for points on a sphere- it’s all points that are the radius away from the center of the sphere. The problem I’m having is getting actual points out of that equation. Picking x and y points randomly is likely to lead to a situation where there is no z value that fits on the sphere. I’m sure there’s some easy way to do this but, as usual, my complete lack of education in 3d geometry is not helping me out here.

I found this sphere FAQ which might provide some helpful info. I also found this discussion about how to convert spherical coordinates into cartesian coordinates. And, doing a bit more searching, I think this will probably do the trick.

posted at 11:30 on Sat, 23 Feb, 2008 | path: /school



Return to Jen's Blog

All material copyrighted by Jen Schellinck. All rights reserved.