diff -r b42788f5d0a9 -r eb74680a5e43 geometry.py --- a/geometry.py Tue Jan 16 17:29:40 2018 +0200 +++ b/geometry.py Fri Jan 19 13:41:23 2018 +0200 @@ -188,15 +188,18 @@ for v1, v2 in pairs(self.vertices): yield LineSegment(v1, v2) @property - def smallest_angle(self): - from math import acos, inf - min_angle = inf + def angles(self): + from math import acos for v1, v2, v3 in pairs(self.vertices, count = 3): vec1 = (position_vector(v3) - position_vector(v2)).normalized() vec2 = (position_vector(v1) - position_vector(v2)).normalized() cosine = dot_product(vec1, vec2) / vec1.length() / vec2.length() - min_angle = min(min_angle, angle_magnitude_key(acos(cosine))) - return min_angle + yield acos(cosine) + @property + def smallest_angle(self): + return min( + angle_magnitude_key(angle) + for angle in self.angles) @property def hairline_ratio(self): lengths = [line.length for line in self.perimeter_lines]