Details
-
Type:
Improvement
-
Status: Done
-
Resolution: Done
-
Fix Version/s: None
-
Component/s: geom
-
Labels:None
-
Story Points:2
-
Epic Link:
-
Sprint:AP F18-1
-
Team:Alert Production
Description
As discussed on GitHub, it would be useful if Box2I and Box2D had methods for creating boxes centered on a particular (fractional) point.
Given that the Box* classes cannot afford more constructors, and we still don't have a good way to discover functions, this capability is best implemented as static factory methods:
Box2I Box2I::makeCenteredBox(Point2D const& center, Box2I::Extent const& size);
|
Box2D Box2D::makeCenteredBox(Point2D const& center, Box2D::Extent const& size);
|
I do not plan to add a Box2I::makeCenteredBox(Point2I, Extent) method: I'm worried that it might lead to confusion with (Point2D, Extent), and as Jim Bosch pointed out it's not clear what the best behavior is for even-sized boxes.
The desired functionality is already present in the implementation for Exposure::getCutout, so this work is just a matter of factoring the code, writing new unit tests, and being very careful about the distinctions between Box2I and Box2D.
Attachments
Issue Links
Activity
Field | Original Value | New Value |
---|---|---|
Epic Link |
|
Risk Score | 0 |
Description |
As discussed on [GitHub|https://github.com/lsst/afw/pull/357#discussion_r192899255], it would be useful if {{Box2I}} and {{Box2D}} had methods for creating boxes centered on a particular (fractional) point.
Given that the {{Box*}} classes cannot afford more constructors, and we still don't have a good way to discover functions, this capability is best implemented as static factory methods: {noformat} Box2I Box2I::makeCenteredBox(Point2D const& center, Box2I::Extent const& size); Box2D Box2D::makeCenteredBox(Point2D const& center, Box2D::Extent const& size); {noformat} I do not plan to add a {{Box2I::makeCenteredBox(Point2I, Extent)}} method: I'm worried that it might lead to confusion with {{(Point2D, Extent}}}}, and as [~jbosch] pointed out it's not clear what the best behavior is for even-sized boxes. The desired functionality is already present in the implementation for {{Exposure::getCutout}}, so this work is just a matter of factoring the code, writing new unit tests, and being very careful about the distinctions between {{Box2I}} and {{Box2D}}. |
As discussed on [GitHub|https://github.com/lsst/afw/pull/357#discussion_r192899255], it would be useful if {{Box2I}} and {{Box2D}} had methods for creating boxes centered on a particular (fractional) point.
Given that the {{Box*}} classes cannot afford more constructors, and we still don't have a good way to discover functions, this capability is best implemented as static factory methods: {noformat} Box2I Box2I::makeCenteredBox(Point2D const& center, Box2I::Extent const& size); Box2D Box2D::makeCenteredBox(Point2D const& center, Box2D::Extent const& size); {noformat} I do not plan to add a {{Box2I::makeCenteredBox(Point2I, Extent)}} method: I'm worried that it might lead to confusion with {{(Point2D, Extent)}}, and as [~jbosch] pointed out it's not clear what the best behavior is for even-sized boxes. The desired functionality is already present in the implementation for {{Exposure::getCutout}}, so this work is just a matter of factoring the code, writing new unit tests, and being very careful about the distinctions between {{Box2I}} and {{Box2D}}. |
Rank | Ranked higher |
Rank | Ranked lower |
Sprint | AP F18-1 [ 746 ] |
Rank | Ranked lower |
Status | To Do [ 10001 ] | In Progress [ 3 ] |
Reviewers | Jim Bosch [ jbosch ] | |
Status | In Progress [ 3 ] | In Review [ 10004 ] |
Status | In Review [ 10004 ] | Reviewed [ 10101 ] |
Resolution | Done [ 10000 ] | |
Status | Reviewed [ 10101 ] | Done [ 10002 ] |