double calculateRaw ( double n , double e ) { // calculate the distance of the normal vector to a plane orthogonal to the light source and passing through zero, // the fraction of distance to vector lenght is proportional to the amount of light that would be hitting a disc // orthogonal to the normal vector double normPlaneDist = ( e + n + a ) / ( ast2 * Math . sqrt ( n * n + e * e + 1 ) ) ; double lightness = Math . max ( 0 , normPlaneDist ) ; return lightness ; }
return 0 .. 1