A test for the ray-cylinder intersection: Sliders to change the setting. Space to reset E key to end. Recommended to use TurboWarp: https://turbowarp.org/
The infinite unit cylinder aligned along: X-axis : y^2 + z^2 = 1 Y axis : x^2 + z^2 = 1 Z axis : x^2 + y^2 = 1 Ray P = P0 + t*P1 Cylinder x^2 + z^2 = r^2 (P0x + t * P1x)^2 + (P0z + t * P1z)^2 = r^2 ==> [(P1x)^2 + (P1z)^2] * t^2 + [2 * (P0x * P1x) + 2 * (P0z * P1z)] + [(P0x)^2 + (P0z)^2 - r^2] = 0 The finite open ended cylinder x^2 + z^2 = r^2 ymin < y < ymax