To reflect the ball off of the polyline, we need to re?ect it off of the segment that had the minimum thit. But the reflection computation depends only on thit, n, P and v, so there is actually no need to keep track of which segment was hit. Save thit and n as member variables of the polyline, updating ˆ n in thit at the same time as thit. These will then be the appropriate values when the polyline's reflect is called.