code: static boolean isConvexUsingMaxDistantPoints(List<Point2D_I32> contour , int indexA , int indexB )
  	{
  		double d = Math.sqrt(distanceSq(contour.get(indexA),contour.get(indexB)));
  
  		// conservative upper bounds would be 1/2 a circle, including interior side.
  		int maxAllowed = (int)((Math.PI+1)*d+0.5);
  
  		int length0 = CircularIndex.distanceP(indexA,indexB,contour.size());
  		int length1 = CircularIndex.distanceP(indexB,indexA,contour.size());
  
  		return length0 <= maxAllowed && length1 <= maxAllowed;
  	}
docs: If point B is the point farthest away from A then by definition this means no other point can be farther
  away.If the shape is convex then the line integration from A to B or B to A cannot be greater than 1/2
  a circle. This test makes sure that the line integral meets the just described constraint and is thus
  convex.
  
  NOTE: indexA is probably the top left point in the contour, since that's how most contour algorithm scan
  but this isn't known for sure. If it was known you could make this requirement tighter.
  
  @param contour Contour points
  @param indexA index of first point
  @param indexB index of second point, which is the farthest away from A.
  @return if it passes the sanity check