public double getMinDist(Point2D ref) {
		double result = Double.MAX_VALUE;
		for (CubicCurve2D.Double c : beziers) {
			final double d1 = ref.distance(c.x1, c.y1);
			if (d1 < result) {
				result = d1;
			}
			final double d2 = ref.distance(c.x2, c.y2);
			if (d2 < result) {
				result = d2;
			}
			final double d3 = ref.distance(c.ctrlx1, c.ctrly1);
			if (d3 < result) {
				result = d3;
			}
			final double d4 = ref.distance(c.ctrlx2, c.ctrly2);
			if (d4 < result) {
				result = d4;
			}
		}
		return result;

	}