remove class variables (should be instance variables)
This commit is contained in:
parent
ec35ad9f5d
commit
210d407bf9
@ -195,10 +195,6 @@ class Coordinate:
|
|||||||
|
|
||||||
|
|
||||||
class Shape:
|
class Shape:
|
||||||
top_left: Coordinate
|
|
||||||
bottom_right: Coordinate
|
|
||||||
mode_3d: bool
|
|
||||||
|
|
||||||
def __init__(self, top_left: Coordinate, bottom_right: Coordinate):
|
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
|
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.bottom_right = bottom_right
|
||||||
self.mode_3d = top_left.z is not None and bottom_right.z is not None
|
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:
|
if not self.mode_3d:
|
||||||
return (self.bottom_right.x - self.top_left.x + 1) * (self.bottom_right.y - self.top_left.y + 1)
|
return (self.bottom_right.x - self.top_left.x + 1) * (self.bottom_right.y - self.top_left.y + 1)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user