Esempio n. 1
0
        private CartesianCoordinate getWaveVector(
            SpectrumUnit waveLength,
            double refractiveIndex,
            SphericalCoordinate angle)
        {
            SphericalCoordinate radianAngles = angle.ToRadians();

            radianAngles.Radius = waveLength.ToType(SpectrumUnitType.WaveNumber) * refractiveIndex; // k_mod

            return(radianAngles.ConvertToCartesian());
        }
Esempio n. 2
0
        /// <summary>
        /// Creates the Cartesian coordinate from Spherical coordinates.
        /// </summary>
        /// <param name="spherical">The spherical.</param>
        /// <returns>
        /// The Cartesian coordinate.
        /// </returns>
        public static CartesianCoordinate ConvertToCartesian(this SphericalCoordinate spherical)
        {
            var sphericalRad = spherical.ToRadians();

            double radsin = sphericalRad.Radius * Math.Sin(sphericalRad.Polar);

            return(new CartesianCoordinate(
                       radsin * Math.Cos(sphericalRad.Azimuth),
                       radsin * Math.Sin(sphericalRad.Azimuth),
                       sphericalRad.Radius * Math.Cos(sphericalRad.Polar)));
        }