MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / randomDir

Function randomDir

Engine/source/math/mathUtils.cpp:255–279  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

253//-----------------------------------------------------------------------------
254
255Point3F 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

Callers 6

blowUpMethod · 0.85
launchDebrisMethod · 0.85
generateNodesMethod · 0.85
createSplitMethod · 0.85
startSplitsMethod · 0.85

Calls 5

createOrientFromDirFunction · 0.85
getColumnMethod · 0.80
randFMethod · 0.80
mulPMethod · 0.80
setMatrixMethod · 0.45

Tested by

no test coverage detected