Ejemplo n.º 1
0
        public void ToRadians_ValueTest()
        {
            var degree      = 180;
            var expectedRad = Math.PI;

            var rad = Astrometry.ToRadians(degree);

            Assert.AreEqual(expectedRad, rad);
        }
Ejemplo n.º 2
0
        private (double width, double height) GetBoundingBoxOfRotatedRectangle(double rotation, double width, double height)
        {
            if (rotation == 0)
            {
                return(width, height);
            }
            var rot = Astrometry.ToRadians(rotation);

            return(Math.Abs(width * Math.Sin(rot) + height * Math.Cos(rot)), Math.Abs(height * Math.Sin(rot) + width * Math.Cos(rot)));
        }
Ejemplo n.º 3
0
        public void CreateByDegreeTest(double inputDegrees)
        {
            var angle = Angle.ByDegree(inputDegrees);

            var expectedHours  = Astrometry.DegreesToHours(inputDegrees);
            var expectedArcmin = Astrometry.DegreeToArcmin(inputDegrees);
            var expectedArcsec = Astrometry.DegreeToArcsec(inputDegrees);
            var expectedRadian = Astrometry.ToRadians(inputDegrees);

            Assert.AreEqual(expectedHours, angle.Hours, TOLERANCE);
            Assert.AreEqual(expectedRadian, angle.Radians, TOLERANCE);
            Assert.AreEqual(inputDegrees, angle.Degree, TOLERANCE);
            Assert.AreEqual(expectedArcmin, angle.ArcMinutes, TOLERANCE);
            Assert.AreEqual(expectedArcsec, angle.ArcSeconds, TOLERANCE);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Gets start arguments for Platesolve2 out of RA,Dec, ArcDegWidth, ArcDegHeight and ImageFilePath
        /// </summary>
        /// <returns></returns>
        protected override string GetArguments(
            string imageFilePath,
            string outputFilePath,
            PlateSolveParameter parameter,
            PlateSolveImageProperties imageProperties)
        {
            var args = new string[] {
                Astrometry.ToRadians(parameter.Coordinates.RADegrees).ToString(CultureInfo.InvariantCulture),
                Astrometry.ToRadians(parameter.Coordinates.Dec).ToString(CultureInfo.InvariantCulture),
                Astrometry.ToRadians(imageProperties.FoVW).ToString(CultureInfo.InvariantCulture),
                Astrometry.ToRadians(imageProperties.FoVH).ToString(CultureInfo.InvariantCulture),
                parameter.Regions.ToString(),
                imageFilePath,
                "0"
            };

            return(string.Join(",", args));
        }
Ejemplo n.º 5
0
        public void OperatorMultiplyDoubleTest(double firstDegree, double secondDegree)
        {
            var secondAngle = Angle.ByDegree(secondDegree);

            var angle = Astrometry.ToRadians(firstDegree) * secondAngle;

            var expectedRadian = Astrometry.ToRadians(firstDegree) * Astrometry.ToRadians(secondDegree);
            var expectedDegree = Astrometry.ToDegree(expectedRadian);
            var expectedArcmin = Astrometry.DegreeToArcmin(expectedDegree);
            var expectedArcsec = Astrometry.DegreeToArcsec(expectedDegree);
            var expectedHours  = Astrometry.DegreesToHours(expectedDegree);

            Assert.AreEqual(expectedDegree, angle.Degree, TOLERANCE);
            Assert.AreEqual(expectedArcmin, angle.ArcMinutes, TOLERANCE);
            Assert.AreEqual(expectedArcsec, angle.ArcSeconds, TOLERANCE);
            Assert.AreEqual(expectedHours, angle.Hours, TOLERANCE);
            Assert.AreEqual(expectedRadian, angle.Radians, TOLERANCE);
        }