Reflection point on a sphere
[posr,incid] = CL_gm_reflectionPtSph(pos1,pos2,srad,pos2_inf);
Computes the (specular) reflection point on a sphere whose centre is the origin of the reference frame.
Let P1 and P2 be 2 positions outside the sphere.
The reflection point Pr is defined by identical incident and reflected angles: theta1 = theta2,
where: theta1 = angle(P1-Pr, Pr)
and: theta2 = angle(P2-Pr, Pr)
Note that Pr is the same as Pr-[0;0;0] because the centre of the sphere is assumed to be the origin of the reference frame.
If P2 is considered to be "at infinity" (using optional pos2_inf), then theta2 is defined by:
theta2 = angle(P2, Pr)
which means that P2 is considered as the direction of object 2 rather than its position.
Position of object 1 in cartesian coordinates (3xN or 3x1)
Position of object 2 in cartesian coordinates (relative to the same frame as object 1) (3xN or 3x1)
Sphere radius (1xN or 1x1)
(optional, boolean) Computation option: %t if object 2 is considered to be at infinity, %f otherwise. Default is %f
Position of reflection point (3xN)
Incidence at reflection point. NB: can be more than 90 degrees (1xN)
DCT/SB
// Example 1: simple case alpha = linspace(-%pi/2, %pi/2, 11); pos1 = 2 * [1;0;0]; pos2 = 2 * [cos(alpha); sin(alpha); zeros(alpha)]; [posr, incid] = CL_gm_reflectionPtSph(pos1, pos2, 1); theta1 = CL_vectAngle(pos1*ones(alpha)-posr, posr); theta2 = CL_vectAngle(pos2-posr, posr); disp(theta2 - theta1); // should be 0 disp(theta1 - incid); // should be 0 // Example 2: Sun glint // Satellite's positions in inertial frame: kep0 = [ %CL_eqRad+700.e3; 0; 1.1; 0; 0.8; 0 ]; t0 = CL_dat_cal2cjd(2000,3,21); t = linspace(t0,t0+0.1,200); kep = CL_ex_secularJ2(t0, kep0, t); pos_sat = CL_oe_kep2car(kep); // Sun's positions in inertial frame: [r_sun,rs] = CL_mod_moonSunG50(t,'s'); pos_sun = CL_dMult(rs,r_sun); // Position of Sun reflection point in same frame: [pos_glint, incid] = CL_gm_reflectionPtSph(pos_sat,pos_sun,%CL_eqRad); I = find(incid >= %pi/2); pos_glint(:,I) = %nan; scf(); CL_plot_ephem(pos_sat, color_id=2); CL_plot_ephem(pos_glint, color_id=5); CL_plot_ephem(pos_sun, color_id=-1); | ![]() | ![]() |