mat33 randomInertiaMatrix() { // generate random valid inertia matrix by first getting valid components // along major axes and then rotating by random amount vec3 principal = randomInertiaPrincipal(); mat33 rot(transformX(randomFloat(-BT_ID_PI, BT_ID_PI)) * transformY(randomFloat(-BT_ID_PI, BT_ID_PI)) * transformZ(randomFloat(-BT_ID_PI, BT_ID_PI))); mat33 inertia; inertia(0, 0) = principal(0); inertia(0, 1) = 0; inertia(0, 2) = 0; inertia(1, 0) = 0; inertia(1, 1) = principal(1); inertia(1, 2) = 0; inertia(2, 0) = 0; inertia(2, 1) = 0; inertia(2, 2) = principal(2); return rot * inertia * rot.transpose(); }
ZPoint ZStTransform::transform(const ZPoint &pt) const { return ZPoint(transformX(pt.x()), transformY(pt.y()), transformZ(pt.z())); }