-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add Cartesian class for coordinate operations
- Loading branch information
Showing
6 changed files
with
99 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,30 @@ | ||
from cloudvolume.lib import Bbox | ||
from cloudvolume.lib import Bbox, Vec | ||
|
||
from chunkflow.lib.bounding_boxes import BoundingBox | ||
from chunkflow.lib.bounding_boxes import BoundingBox, Cartesian | ||
|
||
|
||
def test_cartesian(): | ||
ct = Cartesian(1,2,3) | ||
ct += 2 | ||
ct == Cartesian(3,4,5) | ||
|
||
ct -= 2 | ||
ct == Cartesian(1,2,3) | ||
|
||
ct.vec == Vec(1,2,3) | ||
|
||
def test_bounding_box(): | ||
bbox = Bbox.from_delta((1,3,2), (64, 32, 8)) | ||
bbox = BoundingBox.from_bbox(bbox) | ||
|
||
bbox = bbox.clone() | ||
assert isinstance(bbox, BoundingBox) | ||
|
||
minpt = Cartesian(1,2,3) | ||
maxpt = Cartesian(2,3,4) | ||
bbox = BoundingBox.from_corners(minpt, maxpt) | ||
|
||
bbox = BoundingBox.from_center(Cartesian(1,2,3), 3) | ||
bbox == BoundingBox.from_list([-2, -1, 0, 4, 5, 6]) | ||
|
||
|