pixelX, y1)
      offset &#x3D; (y1 * width + pixelX) * 4;
      pixel[0] &#x3D; elevationData[offset];
      pixel[1] &#x3D; elevationData[offset + 1];
      pixel[2] &#x3D; elevationData[offset + 2];
      pixel[3] &#x3D; elevationData[offset + 3];
      z1 &#x3D; data.vert * (pixel[0] + pixel[1] * 2 + pixel[2] * 3);

      dzdy &#x3D; (z1 - z0) / dp;

      slope &#x3D; Math.atan(Math.sqrt(dzdx * dzdx + dzdy * dzdy));

      aspect &#x3D; Math.atan2(dzdy, -dzdx);
      if (aspect &lt; 0) {
        aspect