Search code examples
pythonanglepvlib

How to calculate the light reflection angle on tridimensional space


I have the follow situation:

One point located on Earth Surface with 3D coordinates (X, Y, Z) and one camera inside the airplane that taken picture from surface. For the camera, I have too the 3D coordinates (X, Y, Z) for the exactly moment that the image was taken.

To this scenario I need calculate the light reflection angle between the point on Earth surface and the camera inside the airplane.

I would like suggestions or ideias to calculate this angle. I know that a possible solution will use the analytical geometry.

I have calculated the sun incidence angle to the point on surface using PVLIB library, but I can't found on pvlib a function to determine the light reflection angle.

Thx for help me!!


Solution

  • I suppose that you used the sun elevation and azimuth angle to calculate the sun incidence vector by some formula such as (suppose azimuth as [N=0 / E=90 / S=180 / W=270]):

    Vx_s = sin(sun_azim) * cos(sun_elev)
    Vy_s = cos(sun_azim) * cos(sun_elev)
    Vz_s = sin(sun_elev)
    

    Considering a light reflection on a flat surface (horizontal with normal vector to zenith), the vector of reflected light (forward light, not considering scattering/dispersion rays, e.g. mirror surface) will be

    Vx_r = sin(sun_azim + 180) * cos(sun_elev)
    Vy_r = cos(sun_azim + 180) * cos(sun_elev)
    Vz_r = sin(sun_elev)
    

    The vector of the plane camera is:

    Vx_p = X_plane - X_surface
    Vy_p = Y_plane - Y_surface
    Vz_p = Z_plane - Z_surface
    

    Then, the angle between the reflected ray and the airplane camera is (take into account that the plane-site vector is not an unit vector in this example):

    alpha = arccos( (Vx_p*Vx_r + Vy_p*Vy_r + Vz_p*Vz_r) / sqrt(Vx_p**2 + Vy_p**2 + Vz_p**2) )