An implementation of Ramer-Douglas-Peucker in PHP

I couldn't find an implementation of the Ramer-Douglas-Peucker algorithm in PHP. So I made one myself.

Maybe it's useful to you. It's been tested only at a very basic level - I take no responsibility if it doesn't work correctly. (But any feedback, positive or negative, is welcome - contact details.)

View the source, or download it

License conditions: Public Domain

Example usage

//example usage
include "rdp.php";

$line = array(
	0 => array("E"=> 150,"N" => 10),
	1 => array("E" => 200,"N" => 100),
	2 => array("E" => 360,"N" => 170),
	3 => array("E" => 500,"N" => 280));
//try calling RamerDouglasPeucker() with different values of $epsilon - eg. 10 or 50
$rdpResult = RamerDouglasPeucker($line, 30);
var_dump ($rdpResult);