Beispiel #1
0
        public void Presek(Krug k1, Tacka[] Tacke, ObjekatInfo[] Objekti)
        {
            if (Math.Abs(this.Centar.Y - k1.C.Y) < GeoGebra.eps)
            {
                if (Math.Abs(this.Centar.X - k1.C.X) < GeoGebra.eps)
                {
                    return;
                }
                double x = (this.R * this.R - k1.R * k1.R + k1.Centar.X * k1.Centar.X - this.Centar.X * this.Centar.X) / (2 * (k1.Centar.X - this.Centar.X));
                double b = (-2) * this.Centar.Y;
                double c = (x - this.Centar.X) * (x - this.Centar.X) - this.R * this.R;
                if (b * b - 4 * c < 0)
                {
                    return;
                }
                if (b * b - 4 * c < GeoGebra.eps)
                {
                    GeoGebra.DodajTacku(new Tacka(x, (-b) / 2, "A" + (Tacka.NT + 1).ToString(), Color.DarkGray), Tacke, Objekti);
                }
                else
                {
                    double y = (-b + Math.Sqrt(b * b - 4 * c)) / 2;
                    GeoGebra.DodajTacku(new Tacka(x, y, "A" + (Tacka.NT + 1).ToString(), Color.DarkGray), Tacke, Objekti);
                    y = (-b - Math.Sqrt(b * b - 4 * c)) / 2;
                    GeoGebra.DodajTacku(new Tacka(x, y, "A" + (Tacka.NT + 1).ToString(), Color.DarkGray), Tacke, Objekti);
                    return;
                }
            }
            double k = (this.Centar.X - k1.Centar.X) / (k1.Centar.Y - this.Centar.Y);
            double n = (this.R * this.R - k1.R * k1.R + k1.Centar.X * k1.Centar.X - this.Centar.X * this.Centar.X + k1.Centar.Y * k1.Centar.Y - this.Centar.Y * this.Centar.Y) / (2 * (k1.Centar.Y - this.Centar.Y));
            Prava  p = new Prava(k, n, "");

            this.Presek(p, Tacke, Objekti);
        }
Beispiel #2
0
        public virtual void Presek(Krug s, Tacka[] Tacke, ObjekatInfo[] Objekti)
        {
            if (s.Centar.Rastojanje(this) - s.R > GeoGebra.eps)
            {
                return;
            }
            double a = 1 + this.K * this.K;
            double b = -2 * s.Centar.X + 2 * this.K * this.N - 2 * this.K * s.Centar.Y;
            double c = s.Centar.X * s.Centar.X + this.N * this.N + s.Centar.Y * s.Centar.Y - 2 * this.N * s.Centar.Y - s.R * s.R;

            if (Math.Abs(s.Centar.Rastojanje(this) - s.R) < GeoGebra.eps)
            {
                double x = (-b) / (2 * a);
                double y = this.K * x + this.N;
                GeoGebra.DodajTacku(new Tacka(x, y, "A" + (Tacka.NT + 1).ToString(), Color.DarkGray), Tacke, Objekti);
                return;
            }
            if (s.R - s.Centar.Rastojanje(this) > GeoGebra.eps)
            {
                double x = ((-b) + Math.Sqrt(b * b - 4 * a * c)) / (2 * a);
                double y = this.K * x + this.N;
                GeoGebra.DodajTacku(new Tacka(x, y, "A" + (Tacka.NT + 1).ToString(), Color.DarkGray), Tacke, Objekti);
                x = ((-b) - Math.Sqrt(b * b - 4 * a * c)) / (2 * a);
                y = this.K * x + this.N;
                GeoGebra.DodajTacku(new Tacka(x, y, "A" + (Tacka.NT + 1).ToString(), Color.DarkGray), Tacke, Objekti);
                return;
            }
        }
Beispiel #3
0
 public Krug InverzijaNeProlazi(Krug k1)
 {
     return(new Krug(this.Inverzija(new Tacka(k1.Centar.X - k1.R, k1.Centar.Y, "", Color.Black)), this.Inverzija(new Tacka(k1.Centar.X + k1.R, k1.Centar.Y, "", Color.Black)), this.Inverzija(new Tacka(k1.Centar.X, k1.Centar.Y - k1.R, "", Color.Black)), "k" + (Krug.NK + 1).ToString()));
 }
Beispiel #4
0
 public Prava InverzijaProlazi(Krug k1)
 {
     return(new Prava(this.Inverzija(this.Centar.Rotacija(k1.Centar, Math.PI / 2)), this.Inverzija(this.Centar.Rotacija(k1.Centar, -Math.PI / 2)), "p" + (Prava.NP + 1).ToString()));
 }