Choosing best representation for hit detection in computer graphics

57 Views Asked by At

Suppose I have 3D spheres. What is the best representation for the spheres in order to detect whether the end of an arrow hit them? and why?

I thought about an isoparametric representation since it's possible to put the values inside in order to test whether the point is inside or outside.

1

There are 1 best solutions below

0
On

Let the centre of a sphere be $(s_x,s_y,s_z)$ and the sphere has a radius $r$. Let the arrowhead be at $(a_x,a_y,a_z)$.

Determine if:

$$\sqrt{(a_x-s_x)^2+(a_y-s_y)^2+(a_z-s_z)^2}\le r$$

If so, the arrow has punctured the sphere.