Three-axis attitude control based on magnetic torquing