Commit 527b5853 authored by Makayla Shepherd's avatar Makayla Shepherd
Browse files

Corrected the shaded value algorithm. Fixes #4326

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/branches/ipce@7263 41f8697f-d340-4b68-9986-7bafba869bb8
parent 46e21d86
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -256,7 +256,7 @@ namespace Isis {

                            1 + p0*p + q0*q
      shade =  -------------------------------------------------
                 sqrt(1 + p*p + Q*q) + sqrt(1 + p0*p0 + q0*q0)
                 sqrt(1 + p*p + q*q) * sqrt(1 + p0*p0 + q0*q0)

      where p0 = -cos( sun azimuth ) * tan( solar elevation ) and
            q0 = -sin( sun azimuth ) * tan( solar elevation )
@@ -273,7 +273,7 @@ namespace Isis {

      double numerator = 1.0 + p0 * p + q0 * q;

      double denominator = sqrt(1 + p * p + q * q) + sqrt(1 + p0 * p0 + q0 * q0);
      double denominator = sqrt(1 + p * p + q * q) * sqrt(1 + p0 * p0 + q0 * q0);

      result = numerator / denominator;
    }
+2 −0
Original line number Diff line number Diff line
@@ -25,6 +25,8 @@ namespace Isis {
   * @author 2012-10-25 Steven Lambright
   *
   * @internal
   *   @history 2016-11-21 Makayla Shepherd - Corrected the shaded value algorithm in shadedValue. 
   *                           Fixes #4326.
   */
  class Hillshade {
    public:
+9 −9
Original line number Diff line number Diff line
@@ -8,15 +8,15 @@ Assigned valid: Hillshade[ azimuth = 0.0 degrees zenith = 15.0 degrees resolutio


Test computations
Shaded value (flat surface, sun directly up): 0.5
Shaded value (rotated sun's direction):       0.5
Shaded value (lowered solar elevation):       0.49617287
Shaded value (sun is next to the horizon):    0.017153045
Shaded value (solar elevation is 45):         0.41421356
Shaded value (surface tilted towards sun):    0.63708941
Shaded value (surface folded inwards):        0.63708941
Shaded value (surface folded outwards):       0.63708941
Shaded value (surface facing away):          -0.43701602
Shaded value (flat surface, sun directly up): 1
Shaded value (rotated sun's direction):       1
Shaded value (lowered solar elevation):       0.98480775
Shaded value (sun is next to the horizon):    0.017452406
Shaded value (solar elevation is 45):         0.70710678
Shaded value (surface tilted towards sun):    0.98058068
Shaded value (surface folded inwards):        0.98058068
Shaded value (surface folded outwards):       0.98058068
Shaded value (surface facing away):          -0.4472136
Shaded value special (special pixel in surface): 1

Test error handling