It wasn't obvious to me why the last point wasn't included. Add a comment that this function is called for a sequence of line segments and that the last point isn't added because it would duplicate the end points.