remove class variables (should be instance variables)

This commit is contained in:
Stefan Harmuth 2022-08-07 19:34:37 +02:00
parent ec35ad9f5d
commit 210d407bf9

View File

@ -195,10 +195,6 @@ class Coordinate:
class Shape:
top_left: Coordinate
bottom_right: Coordinate
mode_3d: bool
def __init__(self, top_left: Coordinate, bottom_right: Coordinate):
"""
in 2D mode: top_left is the upper left corner and bottom_right the lower right
@ -211,7 +207,7 @@ class Shape:
self.bottom_right = bottom_right
self.mode_3d = top_left.z is not None and bottom_right.z is not None
def size(self):
def __len__(self):
if not self.mode_3d:
return (self.bottom_right.x - self.top_left.x + 1) * (self.bottom_right.y - self.top_left.y + 1)
else: