Example #1
0
 private Tuple<PointF, PointF> GetPointNormal(RectangleF rectA, RectangleF rectB)
 {
     var normal = new PointF();
     var point = new PointF();
     if (Math.Abs(rectA.Left - rectB.Left) < MathUtils.PRECISION)
     {
         normal = rectA.LeftNormal();
         point = new PointF(rectA.Left, 0);
     }
     else if (Math.Abs(rectA.Top - rectB.Top) < MathUtils.PRECISION)
     {
         normal = rectA.TopNormal();
         point = new PointF(0, rectA.Top);
     }
     else if (Math.Abs(rectA.Right - rectB.Right) < MathUtils.PRECISION)
     {
         normal = rectA.RightNormal();
         point = new PointF(rectA.Right, 0);
     }
     else if (Math.Abs(rectA.Bottom - rectB.Bottom) < MathUtils.PRECISION)
     {
         normal = rectA.BottomNormal();
         point = new PointF(0, rectA.Bottom);
     }
     return new Tuple<PointF,PointF>(point, normal);
 }
Example #2
0
 private PointF GetNormal(RectangleF rectA, RectangleF rectB)
 {
     var normal = new PointF();
     //            var point = new PointF();
     if (Math.Abs(rectA.Left - rectB.Left) < MathUtils.PRECISION &&
         rectA.Height >= rectA.Width)
         normal = rectA.LeftNormal();
     else if (Math.Abs(rectA.Top - rectB.Top) < MathUtils.PRECISION &&
         rectA.Width >= rectA.Height)
         normal = rectA.TopNormal();
     else if (Math.Abs(rectA.Right - rectB.Right) < MathUtils.PRECISION &&
         rectA.Height >= rectA.Width)
         normal = rectA.RightNormal();
     else if (Math.Abs(rectA.Bottom - rectB.Bottom) < MathUtils.PRECISION &&
         rectA.Width >= rectA.Height)
         normal = rectA.BottomNormal();
     else
         throw new Exception("Normal Error");
     return normal;
 }