Exemple #1
0
        public void EquatorialMidpoint_OfTwoNonpolarVectors_ShouldBeInOrderWithTheTwoVectorsEquatorialDirections
            (Vector3 u, Vector3 v)
        {
            // Fixture setup
            var directionOfU = AngleUtilities.EquatorialDirection(u);
            var directionOfV = AngleUtilities.EquatorialDirection(v);

            // Exercise system
            var midpoint = AngleUtilities.EquatorialMidpoint(u, v);

            // Verify outcome
            var areInOrder = ArcOrderer.AreInOrder(directionOfU, midpoint, directionOfV);

            var failureString = String.Format("Midpoint was {0}", midpoint);

            Assert.True(areInOrder, failureString);

            // Teardown
        }
Exemple #2
0
        public void EquatorialMidpoint_OfTwoNonpolarVectors_ShouldBeEquidistantFromThoseVectorsEquatorialDirections
            (Vector3 u, Vector3 v)
        {
            // Fixture setup
            var directionOfU = AngleUtilities.EquatorialDirection(u);
            var directionOfV = AngleUtilities.EquatorialDirection(v);

            // Exercise system
            var midpoint = AngleUtilities.EquatorialMidpoint(u, v);

            // Verify outcome
            var distanceToU = Trig.InverseCosine(directionOfU.ScalarMultiply(midpoint));
            var distanceToV = Trig.InverseCosine(directionOfV.ScalarMultiply(midpoint));

            Debug.WriteLine(distanceToU + "," + distanceToV);

            var failureString = String.Format("Midpoint was {0}", midpoint);

            Assert.True(Number.AlmostEqual(distanceToU, distanceToV, Tolerance), failureString);

            // Teardown
        }
        public void LeftIntersection_WhenSweeplinePassesThroughBothFocuses_ShouldReturnEquatorialMidpointOfFocii
            (Arc arc, Sweepline sweepline)
        {
            // Fixture setup
            var colatitudeOfFocus  = arc.Site.Position.SphericalCoordinates().Colatitude;
            var azimuthOfFocus     = arc.Site.Position.SphericalCoordinates().Azimuth;
            var azimuthOfLeftFocus = arc.LeftNeighbour.Position.SphericalCoordinates().Azimuth;

            arc.Site.Position          = new SphericalCoords(colatitudeOfFocus, azimuthOfFocus).CartesianCoordinates();
            arc.LeftNeighbour.Position = new SphericalCoords(colatitudeOfFocus, azimuthOfLeftFocus).CartesianCoordinates();

            // Exercise system
            var directionOfLeftIntersection = arc.LeftIntersection(sweepline);

            // Verify outcome
            var equatorialMidpoint = AngleUtilities.EquatorialMidpoint(arc.LeftNeighbour.Position, arc.Site.Position);
            var failureString      = String.Format("Direction of left intersection: {0},\n",
                                                   directionOfLeftIntersection);

            Assert.True(Vector.AlmostEqual(equatorialMidpoint, directionOfLeftIntersection, Tolerance), failureString);

            // Teardown
        }