Created
November 29, 2017 17:39
-
-
Save reinsteam/ab7c62dc49de29974bfcf37b89dd1d9d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// construct SunDir from cosine of an angle between the vector and zenith (MuS) | |
SunDir.x = 0.0; | |
SunDir.y = MuS; | |
SunDir.z = sqrt(1.0 - MuS * MuS); | |
// construct EyeDir from cosine of an angle between the vector and zenith (Mu) | |
EyeDir.x = 0.0; | |
EyeDir.y = Mu; | |
EyeDir.z = sqrt(1.0 - Mu * Mu); | |
Theta => angular difference of projection SunDir and some vector EyeDirRot onto XZ-plane | |
[ CosTheta 0 SinTheta] | |
RotYMat = [ 0 1 0 ] | |
[-SinTheta 0 CosTheta] | |
// construct EyeDirRot from EyeDir and RotYMat | |
EyeDirRot.x = SinTheta * sqrt(1.0 - Mu * Mu); | |
EyeDirRot.y = Mu | |
EyeDirRot.z = CosTheta * sqrt(1.0 - Mu * Mu); | |
// compute dot-product SunDir and EyeDirRot | |
Nu = dot(SunDir, EyeDirRot) = Mu * MuS + CosTheta * SinFromMu * SinFromMuS; | |
// Express EyeDirRot.z in terms of original parameters | |
EyeDirRot.z = (Mu * MuS - Nu) / SunDir.z; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment