code: function centroidOf(points, dimension) {
      var centroid = new Float32Array(dimension);
      for (var i = 0; i < centroid.length; i++) {
        var sum = 0;
        var count = 0;
        for (var pointIndex = 0; pointIndex < points.length; pointIndex++) {
          var p = points[pointIndex];
          var point = p.getPoint();
          var val = point.getValue(i);
          if (!isNaN(val)) {
            sum += val;
            count++;
          }
        }
        centroid[i] = (sum / count);
      }
      return new PointWrapper(morpheus.VectorUtil.arrayAsVector(centroid));
    }
docs: Computes the centroid for a set of points.
  
  @param points the set of points
  @param dimension the point dimension
  @return the computed centroid for the set of points