Fixed issue # 386
Problem: surface.area (for Building:Surface:Detailed) does not work when first 3 points are linear and numpy is installed.
Solution: This is because numpy does not throw a ZeroDivisionError but raises a RuntimeWarning. Ensure that a ZeroDivisionError is raised in geometry.surface.unit_normal
@@ -75,9 +75,11 @@ def unit_normal(pt_a, pt_b, pt_c):
[[pt_a[0], pt_a[1], 1], [pt_b[0], pt_b[1], 1], [pt_c[0], pt_c[1], 1]]
)
magnitude = (x_val ** 2 + y_val ** 2 + z_val ** 2) ** 0.5
- mag = (x_val / magnitude, y_val / magnitude, z_val / magnitude)
if magnitude < 0.00000001:
- mag = (0, 0, 0)
+ raise ZeroDivisionError
+ mag = (x_val / magnitude, y_val / magnitude, z_val / magnitude)
+ # if magnitude < 0.00000001:
+ # mag = (0, 0, 0)
return mag
