Instead of spending the evening writing a ray-cylinder intersection routine myself I just asked chatgpt for the routine in C++. It provided me with the C++ source. This is a powerful programming tool!