public Rect GetMediatrixEcuation(Point2D p1, Point2D p2,Rect r)
 {
     Point2D halfPoint = new Point2D((p1.x+p2.x)/2f,(p1.y+p2.y)/2f);
     Rational m = new Rational(r.M.denominator,r.M.numerator * -1);
     return new Rect(m, -1 * m.Eval() * halfPoint.x + halfPoint.y);
 }
 public Point2D GetIntersectPoint(Rect r1, Rect r2)
 {
     float x = (r2.N - r1.N) / (float)(r1.PendientEval() - r2.PendientEval());
     float y = r1.Eval(x);
     return new Point2D(x,y);
 }