public static Triple<Boolean,Double, Double> Function_intersectRangeWithDomain (Contour contour,double x1, double x2) {
	if (x1 == x2) return new Triple(false, x1, x2);
	if (x1 < x2) {
		if (x1 < contour.getStart()) x1 = contour.getStart();   // intersect requested range with logical domain
		if (x2 > contour.getEnd()) x2 = contour.getEnd();
		if (x2 <= x1) return new Triple(false,x1,x2);   // requested range and logical domain do not intersect
	} else {
		if (x2 < contour.getStart()) x2 = contour.getStart();   // intersect requested range with logical domain
		if (x1 > contour.getEnd()) x1 = contour.getEnd();
		if (x1 <= x2) return new Triple(false,x1,x2);   // requested range and logical domain do not intersect
	}
	return new Triple(true,x1,x2);
}