Would make sense to have this argument (is_endpoint in the ClosestPoint() function in Polyline2) appear after is_vertex to minimize chances of misuse. that would mean changing a bunch of other uses where this appears, but I think that's the right way to do it long term. Refer to:
https://github.com/HJReachability/ilqgames/pull/24/files#r418777414