merge method

void merge(
  1. double x,
  2. double y,
  3. double intensity
)

Implementation

void merge(double x, double y, double intensity) {
  this.x = (x * intensity + this.x * z) / (intensity + z);
  this.y = (y * intensity + this.y * z) / (intensity + z);
  z = z + intensity;
}