src/main/java/com/mxgraph/util/mxCurve.java
public mxPoint collisionMove(String index, mxRectangle rect, double buffer)
	{
		int hitSeg = intersectRectPerimeterSeg(index, rect);

		// Could test for a second hit (the rect exit, unless the same 
		// segment is entry and exit) and allow for that in movement.
		
		if (hitSeg == -1)
		{
			return null;
		}
		else
		{
			mxPoint[] pointsCurve = getCurvePoints(index);

			double x0 = pointsCurve[hitSeg - 1].getX();
			double y0 = pointsCurve[hitSeg - 1].getY();
			double x1 = pointsCurve[hitSeg].getX();
			double y1 = pointsCurve[hitSeg].getY();
			
			double x = rect.getX();
			double y = rect.getY();
			double width = rect.getWidth();
			double height = rect.getHeight();

			// Whether the intersection is one of the horizontal sides of the rect
			@SuppressWarnings("unused")
			boolean horizIncident = false;
			mxPoint hitPoint = mxUtils.intersection(x, y, x + width, y, x0, y0, x1, y1);
			
			if (hitPoint != null)
			{
				horizIncident = true;
			}
			else
			{
				hitPoint = mxUtils.intersection(x + width, y, x + width, y + height,
						x0, y0, x1, y1);
			}

			if (hitPoint == null)
			{
				hitPoint = mxUtils.intersection(x + width, y + height, x, y + height,
						x0, y0, x1, y1);
				
				if (hitPoint != null)
				{
					horizIncident = true;
				}
				else
				{
					hitPoint = mxUtils.intersection(x, y, x, y + height, x0, y0, x1, y1);
				}
			}

			if (hitPoint != null)
			{
				
			}

		}
		
		return null;
	}
/**
	 * Returns a point to move the input rectangle to, in order to
	 * attempt to place the rectangle away from the curve. NOTE: Curves
	 * are scaled, the input rectangle should be also.
	 * @param index  the curve index specifying the curve to analyse
	 * @param rect the rectangle that is to be moved
	 * @param buffer the amount by which the rectangle is to be moved,
	 * 			beyond the dimensions of the rect
	 * @return the point to move the top left of the input rect to
	 * 			, otherwise null if no point can be determined
	 */
Returns a point to move the input rectangle to, in order to
attempt to place the rectangle away from the curve. NOTE: Curves
are scaled, the input rectangle should be also.
@param index  the curve index specifying the curve to analyse
@param rect the rectangle that is to be moved
@param buffer the amount by which the rectangle is to be moved,
beyond the dimensions of the rect
@return the point to move the top left of the input rect to
, otherwise null if no point can be determined
Returns a point to move the input rectangle to in order to attempt to place the rectangle away from the curve . NOTE : Curves are scaled the input rectangle should be also . @param index the curve index specifying the curve to analyse @param rect the rectangle that is to be moved @param buffer the amount by which the rectangle is to be moved beyond the dimensions of the rect @return the point to move the top left of the input rect to otherwise null if no point can be determined
public mxPoint collisionMove(String index, mxRectangle rect, double buffer)
	{
		int hitSeg = intersectRectPerimeterSeg(index, rect);
		if (hitSeg == -1)
		{
			return null;
		}
		else
		{
			mxPoint[] pointsCurve = getCurvePoints(index);
			double x0 = pointsCurve[hitSeg - 1].getX();
			double y0 = pointsCurve[hitSeg - 1].getY();
			double x1 = pointsCurve[hitSeg].getX();
			double y1 = pointsCurve[hitSeg].getY();
			double x = rect.getX();
			double y = rect.getY();
			double width = rect.getWidth();
			double height = rect.getHeight();
			@SuppressWarnings("unused")
			boolean horizIncident = false;
			mxPoint hitPoint = mxUtils.intersection(x, y, x + width, y, x0, y0, x1, y1);
			if (hitPoint != null)
			{
				horizIncident = true;
			}
			else
			{
				hitPoint = mxUtils.intersection(x + width, y, x + width, y + height,
						x0, y0, x1, y1);
			}
			if (hitPoint == null)
			{
				hitPoint = mxUtils.intersection(x + width, y + height, x, y + height,
						x0, y0, x1, y1);
				if (hitPoint != null)
				{
					horizIncident = true;
				}
				else
				{
					hitPoint = mxUtils.intersection(x, y, x, y + height, x0, y0, x1, y1);
				}
			}
			if (hitPoint != null)
			{
			}
		}
		return null;
	}
public mxPoint collisionMove ( String index , mxRectangle rect , double buffer ) { int hitSeg = intersectRectPerimeterSeg ( index , rect ) ; if ( hitSeg == - 1 ) { return null ; } else { mxPoint [ ] pointsCurve = getCurvePoints ( index ) ; double x0 = pointsCurve [ hitSeg - 1 ] . getX ( ) ; double y0 = pointsCurve [ hitSeg - 1 ] . getY ( ) ; double x1 = pointsCurve [ hitSeg ] . getX ( ) ; double y1 = pointsCurve [ hitSeg ] . getY ( ) ; double x = rect . getX ( ) ; double y = rect . getY ( ) ; double width = rect . getWidth ( ) ; double height = rect . getHeight ( ) ; @ SuppressWarnings ( "unused" ) boolean horizIncident = false ; mxPoint hitPoint = mxUtils . intersection ( x , y , x + width , y , x0 , y0 , x1 , y1 ) ; if ( hitPoint != null ) { horizIncident = true ; } else { hitPoint = mxUtils . intersection ( x + width , y , x + width , y + height , x0 , y0 , x1 , y1 ) ; } if ( hitPoint == null ) { hitPoint = mxUtils . intersection ( x + width , y + height , x , y + height , x0 , y0 , x1 , y1 ) ; if ( hitPoint != null ) { horizIncident = true ; } else { hitPoint = mxUtils . intersection ( x , y , x , y + height , x0 , y0 , x1 , y1 ) ; } } if ( hitPoint != null ) { } } return null ; }
Returns a point to move the input rectangle to, in order to
 attempt to place the rectangle away from the curve.
Returns a point to move the input rectangle to in order to attempt to place the rectangle away from the curve .
// Could test for a second hit (the rect exit, unless the same  // segment is entry and exit) and allow for that in movement. // Whether the intersection is one of the horizontal sides of the rect