In a three dimensional Cartesian space, given a ray in its parametric form: $r(t) = [1, 1, 1] + t[-1, -1, -1]$ find the intersection points between the ray and the following primitives.

a) A sphere centered at the origin with a radius of $1$, and

b) a triangle with vertices $\{[1,0,0]^T , [0,1,0]^T , [0,0,1]^T \}$.

Represent the intersections in their Cartesian coordinates as well as the ray parameters. Write down the intermediate steps of your derivations clearly.

The next part asks me to choose another primitive 3D shape, decide on implicit or parametric surface functions, then make an equation for ray-surface intersection and derive the analytic solution.

I am a little confused on this assignment because I haven't had a physics class before and I don't understand the basics of 3D shapes' geometry or vectors. It's not entirely clear to me what I am supposed to find as an answer or in what form the answers should be written. I looked up the formulas for sphere and triangle intersection, but I can't find a similar example, so I don't know how to solve the problems.


A sphere centered at the origin with a radius $1$ consists of all points whose distance from the origin is at most $1$. The distance between two points $(x_1,y_1,z_1),(x_2,y_2,z_2)$ is $\sqrt{(x_1-x_2)^2+(y_1-y_2)^2+(z_1-z_2)^2}$. This gives you enough information to describe the sphere: $\{ (x,y,z) : x^2+y^2+z^2 \leq 1 \}$.

A triangle with vertices $p_1,p_2,p_3$ is (by definition) the convex hull of $p_1,p_2,p_3$, which is the set of all points $a_1 p_1 + a_2 p_2 + a_3 p_3$ for $a_1,a_2,a_3 \geq 0$ satisfying $a_1 + a_2 + a_3 \leq 1$. In our case, the triangle is defined by $\{ (x,y,z) : x+y+z = 1, \; x,y,z \geq 0 \}$.

The intersection of a shape $S$ and the ray $r$ is just the set of points which belong to both $S$ and $r$. You can find these points by solving a system of equations: every point $(x,y,z)$ on the ray is of the form $x = 1-t,y = 1-t, z=1-t$ for some $t$. You can simplify this by making the substitution $s = 1-t$ to get $(s,s,s)$ instead of $(1-t,1-t,1-t)$. Now you can find the set of points in the intersection by solving a system of inequalities (I'll leave that to you). Having found the solution, the ray parameter is just the corresponding value of $t$, namely $t = 1-s$.

That should be enough to get you started.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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