A computer implemented single-axis pointing pure magnetic control algorithm for a spacecraft based on geometrical analysis, characterized in that the control algorithm comprises the following steps: 1 acquiring following data: coordinates of a target azimuth vector OA, a body axis vector OB and a geomagnetic field vector B in a body system and a spacecraft inertia matrix I; 2 acquiring a pair of non-parallel vectors X and Y in a normal plane of a geomagnetic field; 3 calculating a unit normal vector Z' of an angular acceleration plane through affine transformation of the spacecraft inertia matrix I: X ′ = I − 1 X Y ′ = I − 1 Y Z ′ = X ′ × Y ′ ‖ X ′ × Y ′ ‖ wherein X' and Y' are affine transformed vectors of X and Y and are in a plane of an angular acceleration generated by a magnetic torque; 4 acquiring an optimal control rotation axis OE by a following equation: OE → = NORM OB → + OA → × OB → × OA → × Z ′ where NORM is a vector normalization operator; 5 adjusting control coefficients and calculating a magnetic control torque T, wherein T is in the normal plane of the magnetic field, and the magnetic control torque T is calculated specifically by: calculating a magnitude and a direction of a rotation angular acceleration, ω ̇ r = K p β OE → sign OE → · OB → × OA → + K m ω · OE → wherein K p refers to a control coefficient; β is an inclined angle between the body axis vector OB and the target azimuth vector OA; sign is to obtain a positive/negative operator which is valued as 1 when a dot product of the vectors OE and OD is positive or valued as -1 when the dot product is negative, or valued as 0 when the body axis vector and the target azimuth vector s are perpendicular; an optimal rotation axis OD is perpendicular to OA and OB; K m refers to a control coefficient for controlling an angular velocity in the direction OE; next, calculating a damped angular acceleration: ω ̇ d = K d ω − ω • Z ′ Z ′ wherein K d refers to a control coefficient; ω is the instantaneous angular velocity of the spacecraft, ( ω • Z') Z' is a component perpendicular to the angular acceleration plane in ω, so ω - ( ω • Z ') Z ' is a component in the angular acceleration plane in ω; and then calculating a torque required to generate the rotation angular acceleration and the damped angular acceleration: T = I ω ̇ r + ω ̇ d; and 6 calculating a required control magnetic torque M: M → = B × T ‖ B → ‖ 2 1 acquiring following data: coordinates of a target azimuth vector OA, a body axis vector OB and a geomagnetic field vector B in a body system and a spacecraft inertia matrix I; 2 acquiring a pair of non-parallel vectors X and Y in a normal plane of a geomagnetic field; 3 calculating a unit normal vector Z' of an angular acceleration plane through affine transformation of the spacecraft inertia matrix I: X ′ = I − 1 X Y ′ = I − 1 Y Z ′ = X ′ × Y ′ ‖ X ′ × Y ′ ‖ wherein X' and Y' are affine transformed vectors of X and Y and are in a plane of an angular acceleration generated by a magnetic torque; 4 acquiring an optimal control rotation axis OE by a following equation: OE → = NORM OB → + OA → × OB → × OA → × Z ′ where NORM is a vector normalization operator; 5 adjusting control coefficients and calculating a magnetic control torque T, wherein T is in the normal plane of the magnetic field, and the magnetic control torque T is calculated specifically by: calculating a magnitude and a direction of a rotation angular acceleration, ω ̇ r = K p β OE → sign OE → · OB → × OA → + K m ω · OE → wherein K p refers to a control coefficient; β is an inclined angle between the body axis vector OB and the target azimuth vector OA; sign is to obtain a positive/negative operator which is valued as 1 when a dot product of the vectors OE and OD is positive or valued as -1 when the dot product is negative, or valued as 0 when the body axis vector and the target azimuth vector s are perpendicular; an optimal rotation axis OD is perpendicular to OA and OB; K m refers to a control coefficient for controlling an angular velocity in the direction OE; next, calculating a damped angular acceleration: ω ̇ d = K d ω − ω • Z ′ Z ′ wherein K d refers to a control coefficient; ω is the instantaneous angular velocity of the spacecraft, ( ω • Z') Z' is a component perpendicular to the angular acceleration plane in ω, so ω - ( ω • Z ') Z ' is a component in the angular acceleration plane in ω; and then calculating a torque required to generate the rotation angular acceleration and the damped angular acceleration: T = I ω ̇ r + ω ̇ d; and 6 calculating a required control magnetic torque M: M → = B × T ‖ B → ‖ 2