#NEWLINE# def v3is_within_tolerance( a , b , tolerance ) : #NEWLINE# #INDENT# "The tolerance must be defined as the square of the cosine angle tolerated. Returns True is 'a' is zero." #NEWLINE# if v3is_zero ( a ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# dot = v3dot ( a , b ) #NEWLINE# if ( tolerance < 0 ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# if ( ( dot * dot ) < ( ( v3lengthsq ( a ) * v3lengthsq ( b ) ) * tolerance ) ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# return True