Exemplo n.º 1
0
        /// <summary>
        /// Returns the output value from the noise module given the
        /// (latitude, longitude) coordinates of the specified input value
        /// located on the surface of the sphere.
        /// </summary>
        /// <param name="lat">The latitude of the input value, in degrees.</param>
        /// <param name="lon">The longitude of the input value, in degrees.</param>
        /// <returns>The output value from the noise module.</returns>
        /// <remarks>
        /// Use a negative latitude if the input value is located on the
        /// southern hemisphere.
        ///
        /// Use a negative longitude if the input value is located on the
        /// western hemisphere.
        /// </remarks>
        public double GetValue(double lat, double lon)
        {
            double x, y, z;

            NoiseMath.LatLonToXYZ(lat, lon, out x, out y, out z);
            return(Source.GetValue(x, y, z));
        }
Exemplo n.º 2
0
 public void LatLonTest(double lat, double lon, double expX, double expY, double expZ)
 {
     NoiseMath.LatLonToXYZ(lat, lon, out double x, out double y, out double z);
     Assert.Equal(expX, x, 6);
     Assert.Equal(expY, y, 6);
     Assert.Equal(expZ, z, 6);
 }
Exemplo n.º 3
0
        public void Math_LatLonToXYZ_Test_2()
        {
            double x, y, z;

            NoiseMath.LatLonToXYZ(-51, 63, out x, out y, out z);

            double expectedX = 0.285705,
                   expectedY = -0.777146,
                   expectedZ = 0.560729;

            Assert.AreEqual(expectedX, Math.Round(x, 6));
            Assert.AreEqual(expectedY, Math.Round(y, 6));
            Assert.AreEqual(expectedZ, Math.Round(z, 6));
        }
Exemplo n.º 4
0
        public void Math_LatLonToXYZ_Test_1()
        {
            double x, y, z;

            NoiseMath.LatLonToXYZ(0, 0, out x, out y, out z);

            double expectedX = 1,
                   expectedY = 0,
                   expectedZ = 0;

            Assert.AreEqual(expectedX, x);
            Assert.AreEqual(expectedY, y);
            Assert.AreEqual(expectedZ, z);
        }
Exemplo n.º 5
0
        public void Math_LatLonToXYZ_Test_4()
        {
            double x, y, z;

            NoiseMath.LatLonToXYZ(45, 45, out x, out y, out z);

            double expectedX = 0.5,
                   expectedY = 0.707107,
                   expectedZ = 0.5;

            Assert.AreEqual(expectedX, Math.Round(x, 6));
            Assert.AreEqual(expectedY, Math.Round(y, 6));
            Assert.AreEqual(expectedZ, Math.Round(z, 6));
        }
Exemplo n.º 6
0
 /// <summary>
 /// Returns the output value from the noise module given the
 /// (latitude, longitude) coordinates of the specified input value
 /// located on the surface of the sphere.
 /// </summary>
 /// <param name="lat">The latitude of the input value, in degrees.</param>
 /// <param name="lon">The longitude of the input value, in degrees.</param>
 /// <returns>The output value from the noise module.</returns>
 /// <remarks>
 /// Use a negative latitude if the input value is located on the
 /// southern hemisphere.
 ///
 /// Use a negative longitude if the input value is located on the
 /// western hemisphere.
 /// </remarks>
 public double GetValue(double lat, double lon)
 {
     NoiseMath.LatLonToXYZ(lat, lon, out double x, out double y, out double z);
     return(this.Source.GetValue(x, y, z));
 }