# point on a sphere

This topic is 4786 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Some time ago I had similar question on the exam and was wonder if someone could show me how to solve it. Its too late now as exam is gone but i would really like to know how to solve it so any help would be much appreciated. For a sphere of radius 5 and centre at (2, 0, 3), which one of the following points is not on the surface? (5, 0, 7) (7, 0, 5) (6, 0, 6) (4, 2, 7.123)

##### Share on other sites
I assume you would simply use the distance formula in 3d

##### Share on other sites
I assume past homework questions are ok, and this could certainly be game-related, so... A sphere with center C and radius r can be represented by the equation:
|X-C| = r
X-C is the vector you get by subtracting the point C from the point X, and |...| means length. A useful equivalent form is:
|X-C|2 = r2
Which squares both sides thereby avoiding the square root. Any point X that satisfies either equation (remember they are equivalent) is on the surface of the sphere. Another useful expression is:
|X-C|2 <= r2
Which represents all points on the surface of and inside the sphere. Note that this is all pretty much an elaboration on Xai's answer.

##### Share on other sites
Here's my take :

Initial conditions : You have a sphere centered on the point (2, 0, 3), of radius 5.

Theoretical data : Canonical equation of a sphere is
sqrt( (x - cx)^2 + (y - cy)^2 + (z - cz)^2 )= r, where
cx is the x value of the center of the sphere
cy is the y value of the center of the sphere
cz is the z value of the center of the sphere
r is the radius of the sphere

Equivalently, we can use a 'simpler' formula by squaring both sides:
(x - cx)^2 + (y - cy)^2 + (z - cz)^2 = r^2

Application : Substituting into the equation with our known values, with
cx = 2
cy = 0
cz = 3
r = 5,
we obtain the following equation for our particular sphere:
(x - 2)^2 + y^2 + (z - 3)^2 = 25

Then, you can just fill in with every value in the list of points.

Practical validation : I whipped up a sample Python program to make sure it worked.
## Sphere surface belonging testpoints = [[5,0,7], [7,0,5], [6, 0, 6], [4, 2, 7.123]]## Loop thru every pointsfor p in points:    ## calculate if the squared distance from the center is    ## around 25    distance = (p[0]-2)*(p[0]-2) + p[1]*p[1] + (p[2]-3)*(p[2]-3)    if( not (distance < 25.1 and distance > 24.9 )):        ## Print it to the user if so        print str(p) + " isn't in the circle."

Results :
[7, 0, 5] isn't in the circle.

There you have it, following my university's problem solving method. ;)

##### Share on other sites
thank you everyone :)

1. 1
2. 2
3. 3
Rutin
15
4. 4
khawk
13
5. 5
frob
12

• 9
• 9
• 11
• 11
• 23
• ### Forum Statistics

• Total Topics
633665
• Total Posts
3013247
×