Changeset 34515
- Timestamp:
- Oct 5, 2012, 1:03:36 PM (14 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/objects/pmSourceOutputs.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/objects/pmSourceOutputs.c
r34499 r34515 227 227 *pltScale = 0.5*(pltScale_x + pltScale_y); 228 228 229 float posAngle_x, posAngle_y; 229 230 float crossProduct = dTPx_dCHx * dTPy_dCHy - dTPx_dCHy * dTPy_dCHx; 230 231 if (crossProduct > 0.) { 231 232 *pltScale *= -1.0; 232 } 233 234 float posAngle_x = atan2 (+dTPy_dCHx, +dTPx_dCHx); 235 float posAngle_y = atan2 (-dTPx_dCHy, +dTPy_dCHy); 233 posAngle_x = atan2 (dTPy_dCHx, dTPx_dCHx); 234 posAngle_y = atan2 (dTPy_dCHy, dTPx_dCHy) - M_PI_2; 235 } else { 236 posAngle_x = atan2 (dTPy_dCHx, -dTPx_dCHx); 237 posAngle_y = atan2 (dTPy_dCHy, dTPx_dCHy) - M_PI_2; 238 } 239 240 // with errors, these may end up on opposite sides of the M_PI boundary. 241 if (posAngle_x - posAngle_y > M_PI) { 242 posAngle_y += 2.0 * M_PI; 243 } 244 if (posAngle_y - posAngle_x > M_PI) { 245 posAngle_x += 2.0 * M_PI; 246 } 236 247 *posAngle = 0.5*(posAngle_x + posAngle_y); 237 248
Note:
See TracChangeset
for help on using the changeset viewer.
