Esempio n. 1
0
        public void Calculate_SetsVectorInCartesian_ForGivenValues(
            double radius,
            double phiInRadians,
            double polarThetaInRadians,
            double expectedX,
            double expectedY,
            double expectedZ)
        {
            // Arrange
            var sut = new SphericalToCartesianCalculator();

            var expected = new CartesianCoordinates
            {
                X = expectedX,
                Y = expectedY,
                Z = expectedZ
            };

            var sphericalCoordinates = new SphericalCoordinates
            {
                Radius = radius,
                Phi    = Angle.FromRadians(phiInRadians),
                Theta  = Angle.FromRadians(polarThetaInRadians)
            };

            sut.SphericalCoordinates = sphericalCoordinates;

            // Act
            sut.Calculate();

            // Assert
            CartesianCoordinatesHelper.AssertCartesianCoordinates(expected,
                                                                  sut.CartesianCoordinates);
        }
Esempio n. 2
0
        public void Setup()
        {
            var angleIntervallCalculator                = new AngleIntervallCalculator();
            var angelInterpolationCalculator            = new AngelInterpolationCalculator(angleIntervallCalculator);
            var sphericalCoordinatesIntervallCalculator =
                new SphericalCoordinatesIntervallCalculator(angelInterpolationCalculator);
            var radiusPhiThetaToSphericalCoordinatesConverter = new RadiusPhiThetaToSphericalCoordinatesConverter();

            var sphericalArcCalculator = new SphericalArcCalculator(sphericalCoordinatesIntervallCalculator,
                                                                    radiusPhiThetaToSphericalCoordinatesConverter);

            var cartesianToSphericalCalculator = new CartesianToSphericalCalculator();
            var sphericalToCartesianCalculator = new SphericalToCartesianCalculator();

            m_Sut = new CartesianSphericalArcCalculator(cartesianToSphericalCalculator,
                                                        sphericalToCartesianCalculator,
                                                        sphericalArcCalculator);
        }