Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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)

share|improve this question
    
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
add comment

1 Answer 1

up vote 0 down vote accepted

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$.

share|improve this answer
    
Well that makes perfect sense. Thanks, especially for the slerp link. –  Geobits Jun 25 '11 at 11:08
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.