' '
preview

1. Summary

Given

  • A ray starting at point \(O = (O_\mathrm{x}, O_\mathrm{y}, O_\mathrm{z})\) and having direction \(\vec\Delta = (\Delta_\mathrm{x}, \Delta_\mathrm{y}, \Delta_\mathrm{z})\).

  • A infinitely long cone with radius \(R\) around the Z-axis.

The intersections can be found using the following steps:

  1. Compute \(O_\mathrm{xy} = (O_\mathrm{x}, O_\mathrm{y})\).

  2. Compute \(\vec\Delta_\mathrm{xy} = (\Delta_\mathrm{x}, \Delta_\mathrm{y})\).

  3. Compute \(\vec V_\mathrm{xy} = O_\mathrm{xy} - (0, 0)\).

  4. Solve the quadratic equation

    \[(\vec\Delta_\mathrm{xy} \cdot \vec\Delta_\mathrm{xy} - \Delta_\mathrm{z}^2) \cdot t^2 + 2 \cdot (\vec\Delta_\mathrm{xy} \cdot \vec V_\mathrm{xy} - O_\mathrm{z} \cdot \Delta_\mathrm{z}) \cdot t + \vec V_\mathrm{xy} \cdot \vec V_\mathrm{xy} - O_\mathrm{z}^2\]
  5. If the quadratic equation has no solutions, the ray does not intersect the cone and the algorithm ends here.

  6. Call the two solutions \(t_1\) and \(t_2\).

  7. The hit positions are

    \[P_1 = O + \vec\Delta \cdot t_1 \qquad P_2 = O + \vec\Delta \cdot t_2\]
  8. The normal at an intersection point \(P = (P_\mathrm{x}, P_\mathrm{y}, P_\mathrm{z})\) is

    \[\vec{N} = \frac{(P_\mathrm{x}, P_\mathrm{y}, -P_\mathrm{z})}{ |(P_\mathrm{x}, P_\mathrm{y}, -P_\mathrm{z})| }\]