private Rotation3 correction_; // correction rotation to be done public PolarCorrectedAlignment(Vect3 newEquAxis, Vect3 prevEquAxis, double altOffset, Rotation3 prevRotationToStand, double equAngle0, double equAngleFactor, AlignStar[] stars) { equAxis_ = newEquAxis; altOffset_ = altOffset; equAngleFactor_ = equAngleFactor; // calculate RotationToStand for equatorial angle = 0 prevRotationToStand = prevRotationToStand * new Rotation3(-equAngle0 * equAngleFactor_, prevEquAxis); // convert coordinates of pole to scope coordinates Vect3 oldScopePoleAxis = prevRotationToStand.Apply(prevEquAxis); Vect3 newScopePoleAxis = prevRotationToStand.Apply(equAxis_); // correct first altitude, then correct azimuth correction_ = new Rotation3(newScopePoleAxis.Alt - oldScopePoleAxis.Alt, new Vect3(newScopePoleAxis.Azm + Math.PI / 2, 0)); correction_ = new Rotation3(newScopePoleAxis.Azm - oldScopePoleAxis.Azm, new Vect3(0, 0, -1)) * correction_; rotationToStand_ = correction_.Conj * prevRotationToStand; if (stars != null && stars.Length > 0) { stars_ = new AlignStar[stars.Length]; for (int i = 0; i < stars.Length; ++i) { if (stars[i] != null) { PairA newScope = DoHorz2Scope((PairA)stars[i].Horz, stars[i].EquAngle); stars_[i] = new AlignStar(stars[i].Name, stars[i].Horz, newScope, stars[i].EquAngle); } } } }
public override bool CorrectOffsets(AlignStar star) { if (star == null) { return(false); } ForceAlignment(); PairA scopeOld = Horz2Scope((PairA)star.Horz, star.EquAngle); double deltaAlt = star.Scope.Alt - scopeOld.Alt, deltaAzm = star.Scope.Azm - scopeOld.Azm; altOffset_ += deltaAlt; rotationToStand_ = new Rotation3(-deltaAzm, new Vect3(0, 0, 1)) * rotationToStand_; //PairA scopeNew = Horz2Scope((PairA)star.Horz, star.EquAngle); foreach (AlignStar s in stars_) { if (s != null) { //scopeNew = Horz2Scope((PairA)s.Horz, s.EquAngle); s.Scope = s.Scope.Offset(+deltaAzm, +deltaAlt); } } return(true); }
public TwoStarsAlignment(Vect3 equAxis, Precisions precesions, AlignStar star) { equAxis_ = equAxis; precesions_ = precesions; stars_[0] = star; alignmentDone_ = false; }
private void MakeAlignment(AlignStar star) { Vect3 v = (new Rotation3(star.EquAngle, equAxis_)).Apply(star.Horz); azmOffset_ = star.Scope.Azm - v.Azm; altOffset_ = star.Scope.Alt - v.Alt; star_ = star; }
public TwoStarsAlignment(Vect3 equAxis, Precisions precesions, AlignStar star0, AlignStar star1) { equAxis_ = equAxis; precesions_ = precesions; stars_[0] = (AlignStar)star0.Clone(); stars_[1] = (AlignStar)star1.Clone(); alignmentDone_ = false; }
// deep cloning private OneStarAlignment(Vect3 equAxis, double azmOffset, double altOffset, AlignStar star, Precisions precesions) { equAxis_ = equAxis; azmOffset_ = azmOffset; altOffset_ = altOffset; if (star != null) { star_ = (AlignStar)star.Clone(); } precesions_ = precesions; }
public override Alignment AddStar(AlignStar newStar) { if (newStar == null) { return(this); } if (stars_[0] == null) { stars_[0] = newStar; } else if (stars_[1] == null) { if (Math.Abs(newStar.EquAngle - stars_[0].EquAngle) > precesions_.iterEquAngleDiff_) { stars_[0] = newStar; } else { stars_[1] = newStar; } } else if (stars_[2] == null) { if (Math.Abs(newStar.EquAngle - stars_[1].EquAngle) > precesions_.iterEquAngleDiff_) { stars_[2] = newStar; } else { stars_[0] = stars_[1]; stars_[1] = newStar; alignmentDone_ = false; } } else if (Math.Abs(newStar.EquAngle - stars_[2].EquAngle) > precesions_.iterEquAngleDiff_) { stars_[2] = newStar; } else { stars_[3] = newStar; ForceAlignment(); return(new FourStarsAlignment(equAxis_, stars_, rotationToStand_, altOffset_, quality_, precesions_)); } return(this); }
public override Alignment AddStar(AlignStar newStar) { if (newStar == null) { return(this); } if (star_ != null && Math.Abs(newStar.EquAngle - star_.EquAngle) <= precesions_.iterEquAngleDiff_) { return(new TwoStarsAlignment(equAxis_, precesions_, star_, newStar)); } else { MakeAlignment(newStar); return(this); } }
public override bool CorrectOffsets(AlignStar star) { if (star == null || star_ == null) { return(false); } PairA scopeOld = Horz2Scope((PairA)star.Horz, star.EquAngle); double deltaAlt = star.Scope.Alt - scopeOld.Alt; double deltaAzm = star.Scope.Azm - scopeOld.Azm; altOffset_ += deltaAlt; azmOffset_ += deltaAzm; if (star_ != null) { star_.Scope = star_.Scope.Offset(+deltaAzm, +deltaAlt); } return(true); }
public override bool CorrectOffsets(AlignStar star) { return(currAlignment_.CorrectOffsets(star)); }
// always returns itself public override Alignment AddStar(AlignStar star) { currAlignment_ = currAlignment_.AddStar(star); return(this); }
public abstract bool CorrectOffsets(AlignStar star);
public abstract Alignment AddStar(AlignStar newStar);
public OneStarAlignment(Vect3 equAxis, Precisions precesions, AlignStar star) { equAxis_ = equAxis; precesions_ = precesions; MakeAlignment((AlignStar)star.Clone()); }
public override Alignment AddStar(AlignStar newStar) { return(this); }
public override bool CorrectOffsets(AlignStar star) { throw new ApplicationException("PolarCorrectedAlignment can't be offset-corrected"); }