User talk:Dostiharise

Refer to this implementation: https://karthaus.nl/rdp/js/rdp2.js

// this is the implementation with perpendicular Distance function RDPppd(points,epsilon){ ...      var lastPoint=points[points.length-1]; ...      for (var i=1;i<points.length-1;i++){ var cDist=findPerpendicularDistance(points[i],firstPoint,lastPoint); ...      }       ...   }

Notice the `lastPoint = points[points.length-1]`