I am writing a game in Python (with pygame) that requires me to generate random but nice-looking \"sea\" for each new game. After a long search I settled on an algorithm that in
As a rough outline, rotate and translate the system so that the line segment lies on the X axis. Now the y coordinate is a cubic function of the parameter t. Find the 'zeros' (the analytic formulae will be found in good math texts or wikipedia). Now evaluate the x coordinates corresponding to those zero points and test against your line segment.