Largest Triangle Three Buckets downsample algorithm by Sveinn Steinarsson reshaped into a node.js module