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 * this.intensity) / intensity + this.intensity;
  this.y =
      (y * intensity + this.y * this.intensity) / intensity + this.intensity;
  this.intensity += intensity;
}