# Creating random triangles with points on the radius of a sphere and passing through center

I'm trying to create a pointy "ball" in 3d space using triangles. I want each triangle to pass through a sphere's center, with each point lying on the surface.

I can easily make points on the surface. Currently I'm doing this by creating a direction vector with random values between -1 and 1. Then I normalize the vector and multiply by the radius to get the final point.

My question is, given two of these points, how can I create a third that is (a) at least semi-random, and (b) ensure it creates a triangle coplanar with the sphere's center.

Update: Forgot to mention, the center of the sphere is always located at (0,0,0)

-
By "radius" do you mean "surface"? And is an answer in terms of points sufficient, or do you want it in terms of the Cartesian coordinates of your original points and the centre? –  Peter Taylor Jun 25 '11 at 7:44
Yes, I meant surface. Just a brain-slip on that one, as I was thinking "a point with distance 'radius' from the center." Also, I forgot to mention, the center of the sphere is at origin(0,0,0), which might make it easier. An answer in terms of points is fine, though. –  Geobits Jun 25 '11 at 9:05

Call your two points $P_1$ and $P_2$, and the centre of the sphere $O$. Three points define a plane. Unless $P_1 - O - P_2$ is a line (in which case you can pick any other point on the surface), they define a plane in which the third point $P_3$ must lie.
The intersection of a plane through a sphere's centre with the sphere is a great circle of the sphere. If you cast a line from $P_1$ through $O$ and another from $P_2$ through $O$ you'll delimit the section of the great circle in which $P_3$ must lie to include $O$ in the triangle. You can then parameterise it uniformly by angle: slerp between $-P_1$ and $-P_2$.