def is_on_line(self, point, resolution=0.001): # This works based on the principle # A--C-----B; where AC,CB,AB a,re a lines # and AC + CB == AB ac = pi_arithmetic.measure(self.start, point) cb = pi_arithmetic.measure(point, self.end) ab = pi_arithmetic.measure(self.start, self.end) return abs((ac + cb) - ab) <= resolution
def fuzzy_compare(self, other): # based on the difference in the number of sizes sides_diff = abs(len(boundary_lines) - len(other.boundary_lines)) # based on the distance between the centroid and geometric center of the path controid_diff = abs( pi_arithmetic.measure(self.rect_info.center, self.calculate_centroid()) - pi_arithmetic.measure(other.rect_info.center, other.calculate_centroid())) return 0.0
def get_length(self): return pi_arithmetic.measure(self.start, self.end)