public override Tacka Presek(Duz d) { if ((Math.Abs(this.K - d.K) > GeoGebra.eps) && ((d.N - this.N) / (this.K - d.K) - Math.Min(this.Tacka1.X, this.Tacka2.X) > -2 * GeoGebra.eps) && (Math.Max(this.Tacka1.X, this.Tacka2.X) - (d.N - this.N) / (this.K - d.K) > -2 * GeoGebra.eps) && ((d.N - this.N) / (this.K - d.K) - Math.Min(d.Tacka1.X, d.Tacka2.X) > -2 * GeoGebra.eps) && (Math.Max(d.Tacka1.X, d.Tacka2.X) - (d.N - this.N) / (this.K - d.K) > -2 * GeoGebra.eps)) { return(new Tacka((d.N - this.N) / (this.K - d.K), (this.K * d.N - d.K * this.N) / (this.K - d.K), "A" + (Tacka.NT + 1).ToString(), Color.DarkGray)); } return(null); }
public double Ugao(Duz d) { if ((Math.Abs(this.K - d.K) < GeoGebra.eps) && (Math.Abs(this.N - d.N) < GeoGebra.eps)) { return(0); } if (Math.Abs(this.K - d.K) < GeoGebra.eps) { return(-1); } return(Math.Round(Math.Min(Math.Abs(Math.Atan(this.K) - Math.Atan(d.K)), Math.PI - Math.Abs(Math.Atan(this.K) - Math.Atan(d.K))) * 360 / (2 * Math.PI), 2)); }
public void PravilanMnogougao(int n1, Tacka[] Tacke, Duz[] Duzi, ObjekatInfo[] Objekti) { Duz d = this; double Fi = Math.PI - 2 * Math.PI / n1; for (int i = 1; i < n1; i++) { GeoGebra.DodajDuz(new Duz(d.Tacka2.Rotacija(d.Tacka1, Fi), d.Tacka1), Duzi, Objekti); GeoGebra.DodajTacku(Duzi[Duz.ND - 1].Tacka1, Tacke, Objekti); d = new Duz(d.Tacka2.Rotacija(d.Tacka1, Fi), d.Tacka1); } Tacke[Tacka.NT - 1] = null; Tacka.NT--; Objekti[Tacka.NT + Prava.NP + Duz.ND + Krug.NK] = null; return; }
public Krug(Tacka A1, Tacka A2, Tacka A3, string ime) { Duz a = new Duz(A1, A2); Duz b = new Duz(A2, A3); if ((Math.Abs(b.K - a.K) < GeoGebra.eps) || (a.Ime == "-1") || (b.Ime == "-1")) { this.C = null; this.r = 0; this.ime = "-1"; } else { this.C = b.Simetrala().Presek(a.Simetrala()); this.r = C.Rastojanje(A1); this.ime = ime; } }
public Prava SimetralaUgla(Duz d) { if (this.Presek(d) == null) { return(null); } if (this.K < d.K) { double k1 = Math.Tan((Math.Atan(this.K) + Math.Atan(d.K)) / 2); double n1 = this.Presek(d).Y - k1 * this.Presek(d).X; return(new Prava(k1, n1, "p" + (Prava.NP + 1).ToString())); } else { double k2 = Math.Tan(Math.PI / 2 + (Math.Atan(this.K) + Math.Atan(d.K)) / 2); double n2 = this.Presek(d).Y - k2 * this.Presek(d).X; return(new Prava(k2, n2, "p" + (Prava.NP + 1).ToString())); } }
public void Presek(Duz d, Tacka[] Tacke, ObjekatInfo[] Objekti) { if (this.Centar.Rastojanje(d) - this.R > GeoGebra.eps) { return; } double a = 1 + d.K * d.K; double b = -2 * this.Centar.X + 2 * d.K * d.N - 2 * d.K * this.Centar.Y; double c = this.Centar.X * this.Centar.X + d.N * d.N + this.Centar.Y * this.Centar.Y - 2 * d.N * this.Centar.Y - this.R * this.R; if (Math.Abs(this.Centar.Rastojanje(d) - this.R) < GeoGebra.eps) { double x = (-b) / (2 * a); double y = d.K * x + d.N; if ((x - Math.Min(d.Tacka1.X, d.Tacka2.X) > -2 * GeoGebra.eps) && (Math.Max(d.Tacka1.X, d.Tacka2.X) - x > -2 * GeoGebra.eps)) { GeoGebra.DodajTacku(new Tacka(x, y, "A" + (Tacka.NT + 1).ToString(), Color.DarkGray), Tacke, Objekti); } return; } if (this.R - this.Centar.Rastojanje(d) > GeoGebra.eps) { double x = ((-b) + Math.Sqrt(b * b - 4 * a * c)) / (2 * a); double y = d.K * x + d.N; if ((x - Math.Min(d.Tacka1.X, d.Tacka2.X) > -2 * GeoGebra.eps) && (Math.Max(d.Tacka1.X, d.Tacka2.X) - x > -2 * GeoGebra.eps)) { 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 = d.K * x + d.N; if ((x - Math.Min(d.Tacka1.X, d.Tacka2.X) > -2 * GeoGebra.eps) && (Math.Max(d.Tacka1.X, d.Tacka2.X) - x > -2 * GeoGebra.eps)) { GeoGebra.DodajTacku(new Tacka(x, y, "A" + (Tacka.NT + 1).ToString(), Color.DarkGray), Tacke, Objekti); } return; } }
public Krug(Tacka A, Duz d, string ime) { this.C = A; this.r = d.Tacka1.Rastojanje(d.Tacka2); this.ime = ime; }