50 |
|
int |
51 |
|
new_input_direction(double new_theta, double new_phi) |
52 |
|
{ |
53 |
– |
if (!input_orient) /* check input orientation */ |
54 |
– |
input_orient = 1 - 2*(new_theta > 90.); |
55 |
– |
else if (input_orient > 0 ^ new_theta < 90.) { |
56 |
– |
fprintf(stderr, |
57 |
– |
"%s: Cannot handle input angles on both sides of surface\n", |
58 |
– |
progname); |
59 |
– |
return(0); |
60 |
– |
} |
53 |
|
/* normalize angle ranges */ |
54 |
|
while (new_theta < -180.) |
55 |
|
new_theta += 360.; |
59 |
|
new_theta = -new_theta; |
60 |
|
new_phi += 180.; |
61 |
|
} |
70 |
– |
if ((theta_in_deg = new_theta) < 1.0) |
71 |
– |
return(1); /* don't rely on phi near normal */ |
62 |
|
while (new_phi < 0) |
63 |
|
new_phi += 360.; |
64 |
|
while (new_phi >= 360.) |
65 |
|
new_phi -= 360.; |
66 |
+ |
/* check input orientation */ |
67 |
+ |
if (!input_orient) |
68 |
+ |
input_orient = 1 - 2*(new_theta > 90.); |
69 |
+ |
else if (input_orient > 0 ^ new_theta < 90.) { |
70 |
+ |
fprintf(stderr, |
71 |
+ |
"%s: Cannot handle input angles on both sides of surface\n", |
72 |
+ |
progname); |
73 |
+ |
return(0); |
74 |
+ |
} |
75 |
+ |
if ((theta_in_deg = new_theta) < 1.0) |
76 |
+ |
return(1); /* don't rely on phi near normal */ |
77 |
|
if (single_plane_incident > 0) /* check input coverage */ |
78 |
|
single_plane_incident = (round(new_phi) == round(phi_in_deg)); |
79 |
|
else if (single_plane_incident < 0) |