Made point class use a position tuple, so can use 2, 3, or more dimensions. Should be a drop in replacement for the old point.
Changes
.gitignore - ignore GUI config
map.py - changed incorrect not tuple to tuple is None
structures.py - using pos tuple for generality, plus x, y, z properties for backwards compatibility.
Had to override __new__ for torch.Tensor allocation
Change to_tensor/from_tensor to support arbitrary dimensions
Overrode __lt__ - doesn't make much sense, but is necessary for heaps (need items to be orderable) and Python supports lexicographic ordering or tuples
__repr__/__init__ specialise for 2D/x,y - this was mainly to pass the tests as-is.
Future possible things to do/questions to reviewers
Add operators to point, so code doesn't need to do diff = Point(dst.x - src.x, dst.y - src.y)
Made point class use a
position
tuple, so can use 2, 3, or more dimensions. Should be a drop in replacement for the old point.Changes
not tuple
totuple is None
pos
tuple for generality, plusx
,y
,z
properties for backwards compatibility.__new__
fortorch.Tensor
allocationto_tensor
/from_tensor
to support arbitrary dimensions__lt__
- doesn't make much sense, but is necessary for heaps (need items to be orderable) and Python supports lexicographic ordering or tuples__repr__
/__init__
specialise for 2D/x,y - this was mainly to pass the tests as-is.Future possible things to do/questions to reviewers
diff = Point(dst.x - src.x, dst.y - src.y)
z
as a keyword argument?Things to review