| 254 | //----------------------------------------------------------------------------- |
| 255 | |
| 256 | Point3F randomDir( const Point3F &axis, F32 thetaAngleMin, F32 thetaAngleMax, |
| 257 | F32 phiAngleMin, F32 phiAngleMax ) |
| 258 | { |
| 259 | MatrixF orient = createOrientFromDir( axis ); |
| 260 | Point3F axisx; |
| 261 | orient.getColumn( 0, &axisx ); |
| 262 | |
| 263 | F32 theta = (thetaAngleMax - thetaAngleMin) * sgRandom.randF() + thetaAngleMin; |
| 264 | F32 phi = (phiAngleMax - phiAngleMin) * sgRandom.randF() + phiAngleMin; |
| 265 | |
| 266 | // Both phi and theta are in degs. Create axis angles out of them, and create the |
| 267 | // appropriate rotation matrix... |
| 268 | AngAxisF thetaRot(axisx, theta * (M_PI_F / 180.0f)); |
| 269 | AngAxisF phiRot(axis, phi * (M_PI_F / 180.0f)); |
| 270 | |
| 271 | Point3F ejectionAxis = axis; |
| 272 | |
| 273 | MatrixF temp(true); |
| 274 | thetaRot.setMatrix(&temp); |
| 275 | temp.mulP(ejectionAxis); |
| 276 | phiRot.setMatrix(&temp); |
| 277 | temp.mulP(ejectionAxis); |
| 278 | |
| 279 | return ejectionAxis; |
| 280 | } |
| 281 | |
| 282 | //----------------------------------------------------------------------------- |
| 283 |
no test coverage detected