#NEWLINE# def quaternion_about_axis( angle , axis ) : #NEWLINE# #INDENT# 'Return quaternion for rotation about axis.\n\n    >>> q = quaternion_about_axis(0.123, (1, 0, 0))\n    >>> numpy.allclose(q, [0.06146124, 0, 0, 0.99810947])\n    True\n\n    ' #NEWLINE# quaternion = numpy . zeros ( ( 4 , ) , dtype = numpy . float64 ) #NEWLINE# quaternion [ : 3 ] = axis [ : 3 ] #NEWLINE# qlen = vector_norm ( quaternion ) #NEWLINE# if ( qlen > _EPS ) : #NEWLINE# #INDENT# quaternion *= ( math . sin ( ( angle / 2.0 ) ) / qlen ) #NEWLINE# #UNINDENT# quaternion [ 3 ] = math . cos ( ( angle / 2.0 ) ) #NEWLINE# return quaternion