private void buttonCorrectPolarAxis_Click(object sender, EventArgs e) { alignment_.CorrectEquAxis(new Vect3(0, latitude_ * Const.toRad)); AlignmentChanged(); }
private void CalcAndOutputResults() { if (!init_) { return; } // if true, make four start alignment (i.e. actually the same two alignment starts, but twice for two equatorial angles) bool fourStars = textBoxPlatformA2.Enabled = textBoxPlatformDA2.Enabled = checkBox4StarAlignment.Checked; string s = ""; try { { //rnd_ = new Random(0); PairA stand1 = ToScope(Star1, equAngle_).Offset(RndAngleErr(), RndAngleErr()); s += "Eq angle = " + (equAngle_ * toDeg).ToString() + ", Star1 in scope coordinates = " + PrintV(stand1) + Environment.NewLine; if (stand1.Below(minAlt_ + altOff_)) { throw new ApplicationException("Star1 is below min altitude"); } PairA stand2 = ToScope(Star2, equAngle_ + equAngleD_).Offset(RndAngleErr(), RndAngleErr()); s += "Eq angle = " + ((equAngle_ + equAngleD_) * toDeg).ToString() + ", Star2 in scope coordinates = " + PrintV(stand2) + Environment.NewLine; if (stand2.Below(minAlt_ + altOff_)) { throw new ApplicationException("Star2 is below min altitude"); } s += Environment.NewLine; PairA stand21 = new PairA(), stand22 = new PairA(); if (fourStars) { stand21 = ToScope(Star1, equAngle2_).Offset(RndAngleErr(), RndAngleErr()); stand22 = ToScope(Star2, equAngle2_ + equAngleD2_).Offset(RndAngleErr(), RndAngleErr()); s += "Eq angle = " + (equAngle2_ * toDeg).ToString() + ", Star1 in scope coordinates = " + PrintV(stand21) + Environment.NewLine; s += "Eq angle = " + ((equAngle2_ + equAngleD2_) * toDeg).ToString() + ", Star2 in scope coordinates = " + PrintV(stand22) + Environment.NewLine; s += Environment.NewLine; } Alignment calc; /* * if (fourStars && (equAngleD_ != 0 || equAngleD2_ != 0)) * { * Vect3 star1 = new Vect3(Star1); * Vect3 star2 = new Vect3(Star2); * int iterations = MakeDynamic4StarAlignment(star1, "Star1", stand1, equAngle_ * equAngleFactor_, * star2, "Star2", stand2, (equAngle_ + equAngleD_) * equAngleFactor_, * star1, "Star1", stand21, equAngle2_ * equAngleFactor_, * star2, "Star2", stand22, (equAngle2_ + equAngleD2_) * equAngleFactor_, * out calc); * s += "Iterations: " + iterations.ToString(); * s += Environment.NewLine; * } * else * */ { calc = new DSCAlignment(new Vect3(0, latitude_), precesions_); calc.AddStar(new AlignStar("Star1", new Vect3(Star1), stand1, equAngle_ * equAngleFactor_)); calc.AddStar(new AlignStar("Star2", new Vect3(Star2), stand2, (equAngle_ + equAngleD_) * equAngleFactor_)); if (fourStars) { calc.AddStar(new AlignStar("Star1", new Vect3(Star1), stand21, equAngle2_ * equAngleFactor_)); calc.AddStar(new AlignStar("Star2", new Vect3(Star2), stand22, (equAngle2_ + equAngleD2_) * equAngleFactor_)); } } s += calc.ToString(true); if (IsEquAxisCorrectionNeeded(latitude_, calc)) { s += Environment.NewLine + AddEquAxisCorrectionText(latitude_, calc); } s += Environment.NewLine; s += Environment.NewLine; s += "OBJECT POSITION" + Environment.NewLine; PairA standObj = ToScope(Obj, objEquAngle_); s += "Object in scope coordinates = " + PrintV(standObj); s += Environment.NewLine; if (standObj.Below(minAlt_ + altOff_)) { throw new ApplicationException("Object is below min altitude"); } PairA calcObj = calc.Scope2Horz(standObj, objEquAngle_ * equAngleFactor_); double errorMin = Math.Asin(Vect3.VMul(new Vect3(Obj), new Vect3(calcObj)).Abs) * toDeg * 60; s += "Calculated Horizontal Object: " + PrintV(calcObj) + ", error " + errorMin.ToString("F2") + " arc min"; s += Environment.NewLine; s += Environment.NewLine; alignment_ = calc; // (Alignment)calc.Clone(); if (IsEquAxisCorrectionNeeded(latitude_, calc)) { calc.CorrectEquAxis(new Vect3(0, latitude_)); s += calc.ToString(true); } } } catch (Exception e) { s += e.Message; s += Environment.NewLine; } textBoxResults.Text = s; }