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

Function randomDir

Engine/source/math/mathUtils.cpp:256–280  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 8

arcaneFX.cppFile · 0.85
afxXM_RandomRotMethod · 0.85
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