src/main/java/com/mxgraph/util/mxCurve.java
public double intersectsRectPerimeterDist(String index, mxRectangle rect)
	{
		double result = -1;
		mxPoint[] pointsCurve = getCurvePoints(index);
		double[] curveIntervals = getIntervals(index);

		if (pointsCurve != null && pointsCurve.length > 1)
		{
			int segIndex = intersectRectPerimeterSeg(index, rect);
			mxPoint intersectPoint = null;

			if (segIndex != -1)
			{
				intersectPoint = intersectRectPerimeterPoint(index, rect,
						segIndex);
			}

			if (intersectPoint != null)
			{
				double startSegX = pointsCurve[segIndex - 1].getX();
				double startSegY = pointsCurve[segIndex - 1].getY();
				double distToStartSeg = curveIntervals[segIndex - 1]
						* getCurveLength(index);
				double intersectOffsetX = intersectPoint.getX() - startSegX;
				double intersectOffsetY = intersectPoint.getY() - startSegY;
				double lenToIntersect = Math.sqrt(intersectOffsetX
						* intersectOffsetX + intersectOffsetY
						* intersectOffsetY);
				result = distToStartSeg + lenToIntersect;
			}
		}

		return result;
	}
/**
	 * Returns the distance from the start of the curve at which this 
	 * curve intersects the boundary of the given rectangle, if it does 
	 * so. If it does not intersect, -1 is returned. 
	 * If it intersects multiple times, the first intersection from 
	 * the start end of the curve is returned.
	 * 
	 * @param index the curve index specifying the curve to analyse
	 * @param rect the whose boundary is to be tested for intersection
	 * with this curve
	 * @return the distance along the curve from the start at which
	 * the intersection occurs
	 */
Returns the distance from the start of the curve at which this
curve intersects the boundary of the given rectangle, if it does
so. If it does not intersect, -1 is returned.
If it intersects multiple times, the first intersection from
the start end of the curve is returned.

@param index the curve index specifying the curve to analyse
@param rect the whose boundary is to be tested for intersection
with this curve
@return the distance along the curve from the start at which
the intersection occurs
Returns the distance from the start of the curve at which this curve intersects the boundary of the given rectangle if it does so . If it does not intersect - 1 is returned . If it intersects multiple times the first intersection from the start end of the curve is returned . @param index the curve index specifying the curve to analyse @param rect the whose boundary is to be tested for intersection with this curve @return the distance along the curve from the start at which the intersection occurs
public double intersectsRectPerimeterDist(String index, mxRectangle rect)
	{
		double result = -1;
		mxPoint[] pointsCurve = getCurvePoints(index);
		double[] curveIntervals = getIntervals(index);
		if (pointsCurve != null && pointsCurve.length > 1)
		{
			int segIndex = intersectRectPerimeterSeg(index, rect);
			mxPoint intersectPoint = null;
			if (segIndex != -1)
			{
				intersectPoint = intersectRectPerimeterPoint(index, rect,
						segIndex);
			}
			if (intersectPoint != null)
			{
				double startSegX = pointsCurve[segIndex - 1].getX();
				double startSegY = pointsCurve[segIndex - 1].getY();
				double distToStartSeg = curveIntervals[segIndex - 1]
						* getCurveLength(index);
				double intersectOffsetX = intersectPoint.getX() - startSegX;
				double intersectOffsetY = intersectPoint.getY() - startSegY;
				double lenToIntersect = Math.sqrt(intersectOffsetX
						* intersectOffsetX + intersectOffsetY
						* intersectOffsetY);
				result = distToStartSeg + lenToIntersect;
			}
		}
		return result;
	}
public double intersectsRectPerimeterDist ( String index , mxRectangle rect ) { double result = - 1 ; mxPoint [ ] pointsCurve = getCurvePoints ( index ) ; double [ ] curveIntervals = getIntervals ( index ) ; if ( pointsCurve != null && pointsCurve . length > 1 ) { int segIndex = intersectRectPerimeterSeg ( index , rect ) ; mxPoint intersectPoint = null ; if ( segIndex != - 1 ) { intersectPoint = intersectRectPerimeterPoint ( index , rect , segIndex ) ; } if ( intersectPoint != null ) { double startSegX = pointsCurve [ segIndex - 1 ] . getX ( ) ; double startSegY = pointsCurve [ segIndex - 1 ] . getY ( ) ; double distToStartSeg = curveIntervals [ segIndex - 1 ] * getCurveLength ( index ) ; double intersectOffsetX = intersectPoint . getX ( ) - startSegX ; double intersectOffsetY = intersectPoint . getY ( ) - startSegY ; double lenToIntersect = Math . sqrt ( intersectOffsetX * intersectOffsetX + intersectOffsetY * intersectOffsetY ) ; result = distToStartSeg + lenToIntersect ; } } return result ; }
Returns the distance from the start of the curve at which this
 curve intersects the boundary of the given rectangle, if it does
 so.
Returns the distance from the start of the curve at which this curve intersects the boundary of the given rectangle if it does so .