Checks if a point is within a triangle

@private
509697
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);
}
132883
function(obj) {
                if (obj.normal) { return obj.intersects(this); }
                return (!this.isParallelTo(obj) && this.distanceFrom(obj) <= sylvester.precision);
              }
594707
def contains_point( self, x, y ):
    """"""
    return ( y * y - ( x * x * x + self.__a * x + self.__b ) ) % self.__p == 0
1110298
@Pure
	boolean containsControlPoint(Point3D p) {
		double x, y, z;
		for(int i=0; i<this.numCoordsProperty.get();) {
			x = this.coordsProperty[i++].get();
			y = this.coordsProperty[i++].get();
			z = this.coordsProperty[i++].get();
			if (x==p.getX() && y==p.getY() && z==p.getZ()) {
				return true;
			}
		}
		return false;
	}
1061844
function checkOverlapping ( bezierPoint, distance ) {

        var forward = bezierPoint.getForward(),
            backward = bezierPoint.getBackward(),
            vertex = bezierPoint.getVertex();

        if ( Vector.fromPoints( forward, vertex ).length() <= distance ) {

            // forward重叠
            return 1;

        } else if ( Vector.fromPoints( backward, vertex ).length() <= distance ) {

            // backward重叠
            return 2;

        }

        // 无重叠
        return 0;

    }
675277
def within_hull(point, hull):
    ''''''
    h_prev_pt = hull[-1,:]
    for h_pt in hull:
        if np.cross(h_pt-h_prev_pt, point - h_pt) >= 0:
            return False
        h_prev_pt = h_pt
    return True
1242589
@Pure
	boolean containsControlPoint(Point3D p) {
		double x, y, z;
		for(int i=0; i<this.numCoords;) {
			x = this.coords[i++];
			y = this.coords[i++];
			z = this.coords[i++];
			if (x==p.getX() && y==p.getY() && z==p.getZ()) {
				return true;
			}
		}
		return false;
	}
1344074
function(geometry) {
        var intersect = false;
        if(geometry.CLASS_NAME == "OpenLayers.Geometry.Point") {
            intersect = this.equals(geometry);
        } else {
            intersect = geometry.intersects(this);
        }
        return intersect;
    }
565167
private boolean checkCandidateUpdate(double[] point) {
    final double x = point[0], y = point[1];
    if(points.isEmpty()) {
      leftx = rightx = x;
      topy = bottomy = y;
      topleft = topright = bottomleft = bottomright = point;
      return true;
    }
    // A non-regular diamond spanned by left, top, right, and bottom.
    if(x <= leftx || x >= rightx || y <= bottomy || y >= topy) {
      double xpy = x + y, xmy = x - y;
      // Update bounds:
      boolean changed = false;
      if(xpy < bottomleft[0] + bottomleft[1]) {
        bottomleft = point;
        changed = true;
      }
      else if(xpy > topright[0] + topright[1]) {
        topright = point;
        changed = true;
      }
      if(xmy < topleft[0] - topleft[1]) {
        topleft = point;
        changed = true;
      }
      else if(xmy > bottomright[0] - bottomright[1]) {
        bottomright = point;
        changed = true;
      }
      if(changed) {
        leftx = Math.max(bottomleft[0], topleft[0]);
        rightx = Math.min(bottomright[0], topright[0]);
        topy = Math.min(topleft[1], topright[1]);
        bottomy = Math.max(bottomleft[1], bottomright[1]);
      }
      return true;
    }
    return false;
  }
78302
function triangleArea(a,b,c){
    return (((b[0] - a[0])*(c[1] - a[1]))-((c[0] - a[0])*(b[1] - a[1])));
}
896912
function isNestedRingClosed(simplePolygon) {
  // check if first and last vertex are the same
  const p0 = simplePolygon[0];
  const p1 = simplePolygon[simplePolygon.length - 1];

  return p0[0] === p1[0] && p0[1] === p1[1] && p0[2] === p1[2];
}
230215
function (point) {
        var rect = this.getRect();
        var axis = this.getAxis();
        var orient = axis.orient;
        if (orient === 'horizontal') {
            return axis.contain(axis.toLocalCoord(point[0]))
            && (point[1] >= rect.y && point[1] <= (rect.y + rect.height));
        }
        else {
            return axis.contain(axis.toLocalCoord(point[1]))
            && (point[0] >= rect.y && point[0] <= (rect.y + rect.height));
        }
    }
1187216
function isConvex(pts, righthanded){
  // 'pts' is an [x,y] pair
  // 'righthanded' is a boolean
  if (typeof(righthanded) === 'undefined') righthanded = true;
  if (pts.length != 3) throw new Error("This function requires an array of three points [x,y]");
  var d = (pts[1][0] - pts[0][0]) * (pts[2][1] - pts[0][1]) - (pts[1][1] - pts[0][1]) * (pts[2][0] - pts[0][0]);
  return (d >= 0) == righthanded;
}
1049996
@Pure
	private static boolean containsTrianglePoint(
			int i0, int i1, double[] v, double[] u1, double[] u2, double[] u3) {
		// is T1 completly inside T2?
		// check if V0 is inside tri(U0,U1,U2)
		double a  = u2[i1] - u1[i1];
		double b  = -(u2[i0] - u1[i0]);
		double c  = -a * u1[i0] - b * u1[i1];
		double d0 = a * v[i0] + b * v[i1] + c;

		a         = u3[i1] - u2[i1];
		b         = -(u3[i0] - u2[i0]);
		c         = -a * u2[i0] - b * u2[i1];
		double d1 = a * v[i0] + b * v[i1] + c;

		a         = u1[i1] - u2[i1];
		b         = -(u1[i0] - u3[i0]);
		c         = -a * u3[i0] - b * u3[i1];
		double d2 = a * v[i0] + b * v[i1] + c;

		return ((d0*d1>0.)&&(d0*d2>0.0));
	}
1345850
function(points, bbox) {
        for (var i = 0; i < points.length; i++) {
            if (this.bboxContainsPoint(points[i], bbox))
                return true;
        }
        return false;
    }
171031
public Triangle findCellTriangleOf(Point3D point) {
        int x_index = (int) ((point.x - indexRegion.minX()) / x_size);
        int y_index = (int) ((point.y - indexRegion.minY()) / y_size);
        return grid[x_index][y_index];
    }
465258
static boolean isInCircle(float x, float y, float centerX, float centerY, float
            radius) {
        return Math.abs(x - centerX) < radius && Math.abs(y - centerY) < radius;
    }