Cluster<T extends ClusterItem>.fromClusters constructor

Cluster<T extends ClusterItem>.fromClusters(
  1. Cluster<T> cluster1,
  2. Cluster<T> cluster2
)

Implementation

Cluster.fromClusters(Cluster<T> cluster1, Cluster<T> cluster2)
    : items = cluster1.items.toSet()..addAll(cluster2.items.toSet()),
      location = LatLng(
        (cluster1.location.latitude * cluster1.count + cluster2.location.latitude * cluster2.count) /
            (cluster1.count + cluster2.count),
        (cluster1.location.longitude * cluster1.count + cluster2.location.longitude * cluster2.count) /
            (cluster1.count + cluster2.count),
      );