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.
Note :
The incidence of the reflexion points can have any value in the range [0, pi].
If only points with incidence less than %pi/2 degrees are desired, it is necessary to filter out the results like this :
[posr,incid] = CL_gm_reflectionPtSph(...); I = find(incid > %pi/2); posr(:,I) = %nan; (or posr(:,I) = [])
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)
CNES - DCT/SB
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); theta2 - theta1 // should be 0 theta1 - incid // should be 0 |