Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a plane sphere inscribed in a cube like in the image below.

enter image description here

Both the sphere and the the cube are centered at the origin.

The cube's edge has a unit length (so one edge of the cube is (0.5,0.5,0.5)

Take a point A(x,y,z) situated on one of the faces of the cube. Take the viewing ray be the line OA (O is the origin)

what is the equation of the point S, where S is the intersection between the line OA and the sphere?

So as you guessed I am interested in projecting the sphere on the cube

share|cite|improve this question
up vote 0 down vote accepted

The equation of the sphere is $$ x^2+y^2+z^2={1\over 4}. $$

Pick a point $(.5,b,c)$ on the "right and forward face" of the cube.

The parametric equation of the line passing through this point is $$\tag{2}x=. 5 t , y= b t, z=c t$$

Now substitute the $x$, $y$, and $z$ values of the above into the equation for the sphere: $$ {1\over4} t^2 +b^2 t^2 + c^2 t^2={1\over 4}. $$

Solve the above equation for $t$. Taking the positive solution, and substituting this value into (2) will give you the point on the sphere (the other solution gives the point in "the back").

You can use a similar method for points on the other faces of the cube.

share|cite|improve this answer

Well, since the sphere has radius $1/2$, the intersection between $OA$ and the sphere is just $$A^\prime \left(\frac{x}{2\sqrt{x^2+y^2+z^2}},\frac{y}{2\sqrt{x^2+y^2+z^2}},\frac{y}{2\sqrt{x^2+y^2+z^2}}\right)$$

because $O,A,A^\prime$ are collinear and $OA^\prime=1/2$.

share|cite|improve this answer

Simply normalize the vector $\vec{OA}$ so it gets length equal to the radius of the sphere ($1/2$, in your case). That's how you get the expressions in Beni Bogosel's answer.

share|cite|improve this answer

Your Answer


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.