2
$\begingroup$

Let $E$ be an ellipsoid centered at $p = (x,y,z) \in \mathbb{R}^3$ and let $T:\mathbb{R}^3 \to \mathbb{R}^3 $ be a linear transformation which transforms $E$ to a unit sphere.

Let $R$ be the ray $p_0 + tv$ ($v$ is normalized).

Assume we want to find the minimal $t \ge 0 $ if any such that $R$ intersects $E$.

I tried to define the ray $R_T$ to be $T(p_0) + tT(v)$ (where $T(v)$ is normalized) and find the minimal $t'\ge0$ if any such that $R_T$ intersects the unit sphere centered at $T(p)$.

If there was no intersection with $t\ge0$ then there is no intersection with $E$. Otherwise the new $t$ is the dot product of $v$ and $T^{-1}(t' \cdot T(v))$. Is this correct?

if $T(v)$ wasn't normalized in $R_T$ and we found the intersection with a sphere then the found $t$ would be the same for $E$ ?

$\endgroup$
  • $\begingroup$ Why don't you just intersect your ray with the ellipsoid, directly. I don't think this is any more difficult than intersecting with a sphere. You'll stiil end up solving a quadratic to find $t$. $\endgroup$ – bubba May 2 '14 at 10:41
  • $\begingroup$ I have a method for finding intersection with a sphere and I have to use it for the ellipsoid. Is the calculation correct? $\endgroup$ – arm46 May 2 '14 at 10:55
1
$\begingroup$

You answer is indeed correct, and this is the foundation of "raytracing", a widely-used technique in graphics. Typically in graphics we are not given $T$ but rather its inverse (the "modeling transform"), so the formulas you'll see in graphics book will have a $T^{-1}$ in them ... but that's because they're talking about a slightly different problem.

If you want to generalize this to a more complicated transformation, $T$, that might include both translation and a linear part, there's a subtlety: in transforming the ray, you need to transform the start-point by $T$, but transform the direction vector by $DT$, the derivative of $T$. When $T$ is linear, the derivative is just $T$, so your formula works fine. When it's got a translation added, the derivative exactly deletes the translation, and the formula needs to take this into account.

(If you also want to transform the normal vector to the sphere, you need to transform that by the transpose of the derivative of $T$, more or less; it depends on how you intend to use the normal vector. (In particular, the transformation I mentioned may change its length, which is a problem if you need a unit vector!)

| cite | improve this answer | |
$\endgroup$

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.