(x, y, z, eps=1e-3)
return abs(cos_theta + 1) < eps
Checks whether three points are almost collinear
Checks whether three points are almost collinear
Checks whether three points are almost collinear
def flat(x, y, z, eps=1e-3):
    """Checks whether three points are almost collinear"""
    np = import_module('numpy')
    vector_a = x - y
    vector_b = z - y
    dot_product = np.dot(vector_a, vector_b)
    vector_a_norm = np.linalg.norm(vector_a)
    vector_b_norm = np.linalg.norm(vector_b)
    cos_theta = dot_product / (vector_a_norm * vector_b_norm)
    return abs(cos_theta + 1) < eps
def flat ( x , y , z , eps = 1e-3 ) : np = import_module ( 'numpy' ) vector_a = x - y vector_b = z - y dot_product = np . dot ( vector_a , vector_b ) vector_a_norm = np . linalg . norm ( vector_a ) vector_b_norm = np . linalg . norm ( vector_b ) cos_theta = dot_product / ( vector_a_norm * vector_b_norm ) return abs ( cos_theta + 1 ) < eps