docs: function pointInTriangle(px, py, ax, ay, bx, by, cx, cy)
  {
      var v0x = cx-ax;
      var v0y = cy-ay;
      var v1x = bx-ax;
      var v1y = by-ay;
      var v2x = px-ax;
      var v2y = py-ay;
  
      var dot00 = v0x*v0x+v0y*v0y;
      var dot01 = v0x*v1x+v0y*v1y;
      var dot02 = v0x*v2x+v0y*v2y;
      var dot11 = v1x*v1x+v1y*v1y;
      var dot12 = v1x*v2x+v1y*v2y;
  
      var invDenom = 1 / (dot00 * dot11 - dot01 * dot01);
      var u = (dot11 * dot02 - dot01 * dot12) * invDenom;
      var v = (dot00 * dot12 - dot01 * dot02) * invDenom;
  
      // Check if point is in triangle
      return (u >= 0) && (v >= 0) && (u + v < 1);
  }