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

Function m_matF_set_euler_C

Engine/source/math/mMath_C.cpp:237–390  ·  view source on GitHub ↗

--------------------------------------

Source from the content-addressed store, hash-verified

235
236//--------------------------------------
237static void m_matF_set_euler_C(const F32 *e, F32 *result)
238{
239 enum {
240 AXIS_X = (1<<0),
241 AXIS_Y = (1<<1),
242 AXIS_Z = (1<<2)
243 };
244
245 U32 axis = 0;
246 if (e[0] != 0.0f) axis |= AXIS_X;
247 if (e[1] != 0.0f) axis |= AXIS_Y;
248 if (e[2] != 0.0f) axis |= AXIS_Z;
249
250 switch (axis)
251 {
252 case 0:
253 m_matF_identity(result);
254 break;
255
256 case AXIS_X:
257 {
258 F32 cx,sx;
259 mSinCos( e[0], sx, cx );
260
261 result[0] = 1.0f;
262 result[1] = 0.0f;
263 result[2] = 0.0f;
264 result[3] = 0.0f;
265
266 result[4] = 0.0f;
267 result[5] = cx;
268 result[6] = sx;
269 result[7] = 0.0f;
270
271 result[8] = 0.0f;
272 result[9] = -sx;
273 result[10]= cx;
274 result[11]= 0.0f;
275
276 result[12]= 0.0f;
277 result[13]= 0.0f;
278 result[14]= 0.0f;
279 result[15]= 1.0f;
280 break;
281 }
282
283 case AXIS_Y:
284 {
285 F32 cy,sy;
286 mSinCos( e[1], sy, cy );
287
288 result[0] = cy;
289 result[1] = 0.0f;
290 result[2] = -sy;
291 result[3] = 0.0f;
292
293 result[4] = 0.0f;
294 result[5] = 1.0f;

Callers

nothing calls this directly

Calls 1

mSinCosFunction · 0.85

Tested by

no test coverage detected