예제 #1
0
 public TwoStarsAlignment(Vect3 equAxis, Precisions precesions, AlignStar star)
 {
     equAxis_       = equAxis;
     precesions_    = precesions;
     stars_[0]      = star;
     alignmentDone_ = false;
 }
예제 #2
0
 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;
 }
예제 #3
0
 // 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;
 }
예제 #4
0
 // deep cloning
 private TwoStarsAlignment(Vect3 equAxis, AlignStar[] stars, bool alignmentDone, double altOffset, Rotation3 rotationToStand, double quality, Precisions precesions)
 {
     equAxis_ = equAxis;
     for (int i = 0; i < stars.Length; ++i)
     {
         if (stars[i] != null)
         {
             stars_[i] = (AlignStar)stars[i].Clone();
         }
     }
     alignmentDone_   = alignmentDone;
     altOffset_       = altOffset;
     rotationToStand_ = rotationToStand;
     quality_         = quality;
     precesions_      = precesions;
 }
예제 #5
0
        // deep cloning
        private FourStarsAlignment(Vect3 equAxis, AlignStar[] stars, Rotation3 rotationToStand, double altOffset, double equHorzDiff, double quality, Precisions precesions, int iterationCnt, bool alignmentDone)
        {
            if (stars.Length < 4 || stars.Length > stars_.Length)
            {
                throw new ApplicationException("too few alignment stars");
            }

            // check equatorial angles: 1) should be within limits for stars 0,1, 2) should be within limits for stars 2,3, and 3) should be different for (0,1) and (2,3) star pairs
            if (Math.Abs(stars[0].EquAngle - stars[1].EquAngle) > precesions.iterEquAngleDiff_ ||
                Math.Abs(stars[2].EquAngle - stars[3].EquAngle) > precesions.iterEquAngleDiff_ ||
                stars[0].EquAngle == stars[2].EquAngle)
            {
                throw new ApplicationException("bad data for 4-stars alignment");
            }

            // check equatorial angles: 1) should be same for stars 0 and 1, 2) should be same for stars 2 and 3, and 3) should be different for (0,1) and (2,3) star pairs
            //if (stars[0].EquAngle != stars[1].EquAngle || stars[2].EquAngle != stars[3].EquAngle || stars[0].EquAngle == stars[2].EquAngle)
            //    throw new ApplicationException("bad data for 4-stars alignment");

            equAxis_ = equAxis;

            for (int i = 0; i < stars.Length; ++i)
            {
                if (stars[i] != null)
                {
                    stars_[i] = (AlignStar)stars[i].Clone();
                }
            }

            rotationToStand_ = rotationToStand;
            altOffset_       = altOffset;
            equScopeDiff_    = stars_[2].EquAngle - stars_[0].EquAngle;
            equHorzDiff_     = equHorzDiff;
            quality_         = quality;
            precesions_      = precesions;
            iterationCnt_    = iterationCnt;
            alignmentDone_   = alignmentDone;
        }
예제 #6
0
 // deep cloning
 private DSCAlignment(Vect3 equAxis, Alignment currAlignment, Precisions precesions)
 {
     equAxis_       = equAxis;
     currAlignment_ = (Alignment)currAlignment.Clone();
     precesions_    = precesions;
 }
예제 #7
0
 public DSCAlignment(Vect3 equAxis, Precisions precesions)
 {
     equAxis_       = equAxis;
     precesions_    = precesions;
     currAlignment_ = new OneStarAlignment(equAxis_, precesions_);
 }
예제 #8
0
 public OneStarAlignment(Vect3 equAxis, Precisions precesions, AlignStar star)
 {
     equAxis_    = equAxis;
     precesions_ = precesions;
     MakeAlignment((AlignStar)star.Clone());
 }
예제 #9
0
 public OneStarAlignment(Vect3 equAxis, Precisions precesions)
 {
     equAxis_    = equAxis;
     precesions_ = precesions;
 }
예제 #10
0
        public static void Align(Vect3 horz0, PairA scope0, Vect3 horz1, PairA scope1, Precisions precesions,
                                 out double altOffset, out Rotation3 rotationToStand, out double quality)
        {
            altOffset = CalcAltOffset(horz0, scope0, horz1, scope1);
            Vect3 s0 = new Vect3(scope0.Offset(0, -altOffset));
            Vect3 s1 = new Vect3(scope1.Offset(0, -altOffset));

            double abs;

            Vect3 n0 = horz0 - s0;

            abs = n0.Abs;
            if (abs < precesions.rotation_)
            {
                double angle = CalcRotationAngle(s0, horz1, s1);
                if (angle == 0 || angle == Math.PI)
                {
                    throw new ApplicationException("Error7");
                }

                quality         = -1;
                rotationToStand = new Rotation3(angle, s0);
                return;
            }
            n0 /= abs;

            Vect3 n1 = horz1 - s1;

            abs = n1.Abs;
            if (abs < precesions.rotation_)
            {
                double angle = CalcRotationAngle(s1, horz0, s0);
                if (angle == 0 || angle == Math.PI)
                {
                    throw new ApplicationException("Error8");
                }

                quality         = -2;
                rotationToStand = new Rotation3(angle, s1);
                return;
            }
            n1 /= abs;

            // axis
            Vect3 axis = Vect3.VMul(n0, n1);

            abs = axis.Abs;
            if (abs < precesions.axis_)
            {
                throw new ApplicationException("Error4");
            }
            axis /= abs;

            double angle0 = CalcRotationAngle(axis, horz0, s0);

            if (angle0 == 0 || angle0 == Math.PI)
            {
                throw new ApplicationException("Error5");
            }

            double angle1 = CalcRotationAngle(axis, horz1, s1);

            if (angle1 == 0 || angle1 == Math.PI)
            {
                throw new ApplicationException("Error6");
            }

            quality         = Math.Abs(angle0 - angle1);
            rotationToStand = new Rotation3((angle0 + angle1) / 2, axis);
        }
예제 #11
0
 public TwoStarsAlignment(Vect3 equAxis, Precisions precesions)
 {
     equAxis_       = equAxis;
     precesions_    = precesions;
     alignmentDone_ = false;
 }