Exemple #1
0
 static string IsCross(Cricle c,Triangle t)
 {
     var d1 = SquareDis(c.xc, c.yc, t.GetPointX(0), t.GetPointY(0));
     var d2 = SquareDis(c.xc, c.yc, t.GetPointX(1), t.GetPointY(1));
     var d3 = SquareDis(c.xc, c.yc, t.GetPointX(2), t.GetPointY(2));
     var RSquare = c.R * c.R;
     if ((d1 < RSquare && d2 < RSquare && d3 < RSquare) )
     {
         return "NO";
     }
     else if ((d1 > RSquare && d2 > RSquare && d3 > RSquare))
     {
         if (IsTouch(c, t.GetPointX(0), t.GetPointY(0), t.GetPointX(1), t.GetPointY(1))||
             IsTouch(c, t.GetPointX(0), t.GetPointY(0), t.GetPointX(2), t.GetPointY(2))||
             IsTouch(c, t.GetPointX(2), t.GetPointY(2), t.GetPointX(1), t.GetPointY(1)))
             return "YES";
         return "NO";
     }
     else {
         return "YES";
     }
 }
Exemple #2
0
 public static Triangle Create()
 {
     var t = new Triangle();
     for (int i = 0; i < 3; i++) {
         string s = Console.ReadLine();
         t.SetPoint(Convert.ToInt32(s.Split(' ')[0]), Convert.ToInt32(s.Split(' ')[1]));
     }
     return t;
 }