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