Exemplo n.º 1
0
        public void Azimuth_Arithmatic_addition()
        {
            Tuple <Double, Double, Double>[] testCases =
            {
                new Tuple <Double, Double, Double>(20.0,         10.0,    -10.0),
                new Tuple <Double, Double, Double>(340.0,       350.0,     10.0),
                new Tuple <Double, Double, Double>(20.0,        340.0,    -40.0),
                new Tuple <Double, Double, Double>(340.0,        20.0,     40.0),
                new Tuple <Double, Double, Double>(189.4326, 173.8145, -15.6181),
            };

            foreach (var testCase in testCases)
            {
                Double     Az1Dbl         = testCase.Item1;
                Double     ExpectedAz2Dbl = testCase.Item2;
                Double     DeflectionDbl  = testCase.Item3;
                Azimuth    Az1            = new Azimuth(); Az1.setFromDegreesDouble(Az1Dbl);
                Deflection defl           = DeflectionDbl.AsPtsDegree();
                Azimuth    Az2            = Az1 + defl;

                Double actualAzimuth = Az2.getAsDegreesDouble();

                Assert.AreEqual(expected: ExpectedAz2Dbl, actual: actualAzimuth, delta: 0.00000001);
            }
        }
Exemplo n.º 2
0
        public void Azimuth_Addition_Az189PlusDeflNeg15_shouldEqual174()
        {
            Double     expectedDbl = 174.0;
            Azimuth    az          = new Azimuth(); az.setFromDegreesDouble(189.0);
            Deflection defl        = new Deflection(); defl.setFromDegreesDouble(-15.0);
            Azimuth    newAz       = az + defl;
            Double     actualDbl   = newAz.getAsDegreesDouble();

            Assert.AreEqual(expected: expectedDbl, actual: actualDbl, delta: delta);
        }
Exemplo n.º 3
0
        public void Azimuth_setToDMS183__29__29_5_shouldResultIn_Angle()
        {
            Azimuth anAzimuth = new Azimuth();

            anAzimuth.setFromDegreesMinutesSeconds(183, 29, 29.5);
            Double expected = 183.4915277778;
            Double actual   = anAzimuth.getAsDegreesDouble();

            Assert.AreEqual(expected: expected, actual: actual, delta: delta);
        }
Exemplo n.º 4
0
        public void Azimuth_1_30_addDeflection_Pos2_15_shouldYieldNewAzimuth_3_45()
        {
            Azimuth anAzimuth = new Azimuth();

            anAzimuth.setFromDegreesMinutesSeconds(1, 30, 0);
            Deflection aDefl = new Deflection();

            aDefl.setFromDegreesMinutesSeconds(2, 15, 0);

            Double  expected = 3.75;
            Azimuth newAz    = anAzimuth + aDefl;
            Double  actual   = newAz.getAsDegreesDouble();

            Assert.AreEqual(expected: expected, actual: actual, delta: delta);
        }
Exemplo n.º 5
0
        public void Azimuth_Subtraction_Az340MinusAz268_equalsDeflectionPos72()
        {
            Azimuth incomingDir = Azimuth.ctorAzimuthFromDegree(268);
            var     str         = incomingDir.ToString();

            Assert.AreEqual(268.0, incomingDir.getAsDegreesDouble(), 0.0000001);
            Azimuth outgoingDir = Azimuth.ctorAzimuthFromDegree(340);

            Assert.AreEqual(340.0, outgoingDir.getAsDegreesDouble(), 0.0000001);
            Deflection def = outgoingDir - incomingDir;

            Assert.AreEqual
                (expected: 72.0
                , actual: def.getAsDegreesDouble()
                , delta: 0.00001);
            Assert.AreEqual
                (expected: 1
                , actual: def.deflectionDirection);
        }
Exemplo n.º 6
0
        public void Azimuth_setFromXY()
        {
            Tuple <Double, Double, Double>[] testCases =
            {
                new Tuple <Double, Double, Double>(10,   2,  78.690067526),
                new Tuple <Double, Double, Double>(10,  -2, 101.309932474),
                new Tuple <Double, Double, Double>(-10,  2, 281.309932474),
                new Tuple <Double, Double, Double>(-10, -2, 258.690067526)
            };

            foreach (var testCase in testCases)
            {
                Azimuth anAzimuth = new Azimuth();
                anAzimuth.setFromXY(testCase.Item1, testCase.Item2);
                Double actualDegrees = anAzimuth.getAsDegreesDouble();

                Assert.AreEqual(expected: testCase.Item3, actual: actualDegrees, delta: delta);
            }
        }