| 39 | } |
| 40 | |
| 41 | mat33 randomInertiaMatrix() |
| 42 | { |
| 43 | // generate random valid inertia matrix by first getting valid components |
| 44 | // along major axes and then rotating by random amount |
| 45 | vec3 principal = randomInertiaPrincipal(); |
| 46 | mat33 rot(transformX(randomFloat(-BT_ID_PI, BT_ID_PI)) * transformY(randomFloat(-BT_ID_PI, BT_ID_PI)) * |
| 47 | transformZ(randomFloat(-BT_ID_PI, BT_ID_PI))); |
| 48 | mat33 inertia; |
| 49 | inertia(0, 0) = principal(0); |
| 50 | inertia(0, 1) = 0; |
| 51 | inertia(0, 2) = 0; |
| 52 | inertia(1, 0) = 0; |
| 53 | inertia(1, 1) = principal(1); |
| 54 | inertia(1, 2) = 0; |
| 55 | inertia(2, 0) = 0; |
| 56 | inertia(2, 1) = 0; |
| 57 | inertia(2, 2) = principal(2); |
| 58 | return rot * inertia * rot.transpose(); |
| 59 | } |
| 60 | |
| 61 | vec3 randomAxis() |
| 62 | { |
nothing calls this directly
no test coverage detected