Check the vertex type between two adjacent edges

# Check whether a vertex between two adjacent edges is smooth or sharp import numpy as np vertices = np.array([(6,7), (10, 12), (8, 5), (7, 11), (5, 7), (8, 8), (12,4), (90, 70), (6, 6), (12, 21)]) vertices_len = len(vertices) decision_threshold = 0.9 # adjust based on your data for i in range(vertices_len): # Edges are defined by (before, common_vertex) and (common_vertex, after) if i + 3 <= vertices_len: before, common_vertex, after = vertices[i:i+3] print(before, common_vertex, after) left_diff, right_diff = abs(after - common_vertex), abs(common_vertex - before) left_normalized = left_diff / np.linalg.norm(left_diff) right_normalized = right_diff / np.linalg.norm(right_diff) dot_product = np.dot(left_normalized, right_normalized) if dot_product > decision_threshold: print(dot_product, '-> smooth') else: print(dot_product, '-> sharp') # is corner print() """ [6 7] [10 12] [8 5] 0.922440988301 -> smooth [10 12] [8 5] [ 7 11] 0.99360525479 -> smooth [8 5] [ 7 11] [5 7] 0.955779008722 -> smooth [ 7 11] [5 7] [8 8] 0.707106781187 -> sharp [5 7] [8 8] [12 4] 0.894427191 -> sharp [8 8] [12 4] [90 70] 0.996545758245 -> smooth [12 4] [90 70] [6 6] 0.998690578913 -> smooth [90 70] [6 6] [12 21] 0.858112923537 -> sharp """