private static agx.SPDMatrix3x3 GetInertiaTensor(Vector3 diagonal, DefaultAndUserValueVector3 offDiagonal) { var inertia = new agx.SPDMatrix3x3(diagonal.ToVec3()); // Off-diagonal elements are by default 0 when the user // has specified the diagonal. if (!offDiagonal.UseDefault) { inertia.set(offDiagonal.UserValue[0], 0, 1); inertia.set(offDiagonal.UserValue[1], 0, 2); inertia.set(offDiagonal.UserValue[2], 1, 2); } return(inertia); }
private static agx.Vec3 GetNativeOffDiagonal(agx.SPDMatrix3x3 nativeInertia) { return(new agx.Vec3(nativeInertia.at(0, 1), nativeInertia.at(0, 2), nativeInertia.at(1, 2))); }