예제 #1
0
        public double AtstumasIki(Taskas pt)
        {
            var x = Math.Pow(X - pt.X, 2);
            var y = Math.Pow(Y - pt.Y, 2);

            return(Math.Sqrt(x + y));
        }
예제 #2
0
        static void Main(string[] args)
        {
            Apskritimas aps = new Apskritimas(5, 8, 10);

            Random rng    = new Random();
            int    kiekis = rng.Next(10, 30);
            Dictionary <Taskas, bool> taskaiApskritimeArNe = new Dictionary <Taskas, bool>();

            while (taskaiApskritimeArNe.Count < kiekis)
            {
                Taskas pt = new Taskas(rng);
                taskaiApskritimeArNe.Add(pt, aps.ArTaskasApskritime(pt));
            }

            foreach (var i in taskaiApskritimeArNe)
            {
                Console.WriteLine(i.Key + " Tilpo: " + i.Value);
            }

            Console.ReadLine();
        }
예제 #3
0
 public bool ArTaskasApskritime(Taskas pt)
 {
     return(R >= Centras.AtstumasIki(pt));
 }
예제 #4
0
 public Apskritimas(Taskas pt, double r)
 {
     Centras = pt;
     R       = r;
 }
예제 #5
0
 public Apskritimas(double x, double y, double r)
 {
     Centras = new Taskas(x, y);
     R       = r;
 }