kb0 / maps_toolkit

Dart library for area, distance, heading measurements
Apache License 2.0
46 stars 17 forks source link

Fix 'PolygonUtil.simplify' bug #5

Closed cdfq152313 closed 4 years ago

cdfq152313 commented 4 years ago

There two issue in 'simplify' function.

  1. The length of dists is wrong. It should be same as poly.length.
  2. dists need to assign default value 0. In java double[] dists = new double[n]; will create an array which all item default value is zero (Cause double is primitive type). In dart final dists = List<num>(0) will create an array which all item default value is null.