I have joined the community inspired by the following question/answers: Line intersection with AABB Rectangle?
There, the original poster asked for a way to detect intersection between a line and a rectangle. One of the answers mentioned that using Cohen–Sutherland algorithm would be much faster than doing 4 Line-to-Line intersections. However, the explanation on how to do was absent (or at most, vague), and while I could find info on that theorem, I didn't find any further explanation/code examples on how to adapt it for the question at hand.
So, I come to you asking a charitable soul for more information, possibly a C#, JavaScript or pseudo-code example, of how could one use Cohen–Sutherland algorithm to efficiently detect the intersection between a line and a rectangle. If there is another fast way of doing that with other algorithm that I am not aware of, I would welcome enlightenment.
Many thanks