The usual way is to save the length of each segment, and then to determine the partial length of the segment that you increase t by epsilon and calculate the linear distance between the two points until you click on your answer. Obviously, the smaller your epsilon, the better the result you get, but it gives surprisingly good results. I used this method to move at a constant speed along camouflage, and you cannot see how it accelerates and decelerates ... it moves at a constant speed. Obviously, depending on how much your segments will have an epsilon value, you will need to change it, but overall you can choose a "good enough" epsilon and everything will be fine.
Finding an answer is not iteratively INCREDIBLY expensive (I saw the output of a back, and it wasn’t very;)). You will need to have a tiny epsilon value to degrade performance ...
source share