1
$\begingroup$

In 3D I have been given a ray and a disc: $$Ray=\mathbf{r_o}+t*\mathbf{\hat{r_d}}$$ $$Disc=\mathbf{\hat{d_n}} \cdot \langle x\;y\;z \rangle=0, ||\mathbf{d_o}-\langle x\;y\;z \rangle||<d_r$$

where

  • $\mathbf{r_o}$ is the ray origin
  • $\mathbf{\hat{r_d}}$ is the ray unit direction vector
  • $t>0$
  • $\mathbf{d_o}$ is the disc center
  • $\mathbf{\hat{d_n}}$ is the disc unit normal vector
  • $d_r$ is the disc radius

I'm trying to find

$$Ray'=\mathbf{r_o} + t*\mathbf{\hat{r_d}'}$$

that intersects the disc and minimizes the angle between $\mathbf{r_d}$ and $\mathbf{\hat{r_d}'}$ (in other words maximizes $\mathbf{\hat{r_d}} \cdot \mathbf{\hat{r_d}'}$). If $\mathbf{\hat{r_d}}$ intersects the disc then naturally $\mathbf{\hat{r_d}'}=\mathbf{\hat{r_d}}$ and otherwise $\mathbf{\hat{r_d}'}$ points towards the disc edge.

This is similar problem as finding the vector for ray-rectangle I posted about earlier, but with different primitive:

Finding ray direction with smallest angle from a ray to a rectangle in 3D

However, I can't use the same approach of constructing supporting planes for the disc since that would require infinite number of planes.

I tried to calculate intersection $\mathbf{r_i}$ of the ray with the plane of the disc and calculated $\mathbf{v}=\frac{\mathbf{r_i}-\mathbf{d_o}}{||\mathbf{r_i}-\mathbf{d_o}||}*d_r$ and $\mathbf{\hat{r_d}'}=\frac{\mathbf{d_o}-\mathbf{r_o}+\mathbf{v}}{||\mathbf{d_o}-\mathbf{r_o}+\mathbf{v}||}$ when the ray doesn't intersect the disc. This however doesn't give correct result, and the error is particularly large when the ray gets more parallel to the disc plane. I was thinking that maybe following the ray-rectangle analogy by defining oblique cone with the disc and $\mathbf{r_o}$ would help and then performing some kind of operation with the cone and $\mathbf{\hat{r_d}}$, but I don't know if this is a proper approach or what this operation should be.

$\endgroup$

1 Answer 1

0
$\begingroup$

Parameterize the circle at the edge of the disk with a single variable $\vec c(s)$

find $s_{max}$ to maximize $f(s) = \frac{(\vec r_0 - \vec c(s))\cdot \vec r_1}{|| \vec r_0 - \vec c(s) ||} $

Then $\vec {r_1'} $ is parallel to $\vec r_0 - \vec c(s_{max})$

$\endgroup$
1
  • $\begingroup$ Yes, that's the theory but I doubt you can really solve it like that. Solving the roots of the derivative is just way too complex. $\endgroup$
    – JarkkoL
    Sep 30, 2015 at 2:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .