-
-
Notifications
You must be signed in to change notification settings - Fork 57
Improve test coverage #238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 17 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
46ea52a
automatic formatting
ffreyer 9c97cf9
add tests for Rect constructors and refactor constructors
ffreyer 2b62573
test the rest of Rect
ffreyer 47d943b
Merge branch 'master' into ff/test-coverage
ffreyer 2140dde
more tests for basic_types.jl
ffreyer 558b364
add triangulation tests
ffreyer 7782992
treat float precision error, add isapprox for Rects
ffreyer 73aedef
test split_mesh
ffreyer 744c51b
improve meshes.jl coverage
ffreyer 89b9921
refactor boundingboxes, add tests
ffreyer ca807f2
test and clean up line intersection code
ffreyer fb756da
fix docs
ffreyer 95ea715
improve Sphere test coverage
ffreyer 23b2346
fix Rect dim truncation
ffreyer b951535
a few more tests for OffsetIntegers & FixedArrays
ffreyer 34795e3
add basic docs for bounding boxes
ffreyer bae73b3
add deprecation warning for developers
ffreyer dc17a63
nvm, doesn't work
ffreyer e33ff0c
fix docs
ffreyer 358d4d1
explicitly test Rect getters/utility functions
ffreyer b1ae5f5
add poly promotion for MultiPolygon
ffreyer 1915d31
fix type targeting in connect
ffreyer f179ff0
fix test failure
ffreyer e330dec
fix 32Bit, 1.6
ffreyer 50c3abc
add more connect tests
ffreyer 99a3e20
make line intersection changes not breaking
ffreyer 5c248f0
fix and test single-face mesh constructor
ffreyer e544dd0
fix tests
ffreyer 1be5f72
test Rect union, update
ffreyer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Bounding Boxes | ||
|
||
You can generate an axis aligned bounding box for any `AbstractGeometry` by calling `Rect(geom)`. | ||
Depending on the object this will either rely on `coordinates(geom)` or a specialized method. | ||
You can also create a bounding box of set dimension or type by adding the related parameters. | ||
|
||
|
||
```@repl | ||
using GeometryBasics | ||
|
||
s = Circle(Point2f(0), 1f0) | ||
Rect(s) # specialized, exact bounding box | ||
Rect3(s) | ||
Rect3d(s) | ||
RectT{Float64}(s) | ||
Rect(GeometryBasics.mesh(s)) # using generated coordinates in mesh | ||
``` | ||
|
||
## Extending | ||
|
||
If you want to add a specialized bounding box method you should implement `Rect{N, T}(geom) = ...`. | ||
All other methods funnel into that one, defaulting to the same `N, T` that the given `AbstractGeometry{N, T}` has. | ||
GeometryBasics allows the user given dimension `N` to be smaller or equal to that of the geometry. | ||
This is checked with `GeometryBasics.bbox_dim_check(user_dim, geom_dim)` which you may reuse. | ||
|
||
```@example | ||
function Rect{N, T}(a::HyperSphere{N2}) where {N, N2, T} | ||
bbox_dim_check(N, N2) | ||
return Rect{N, T}(minimum(a), widths(a)) | ||
end | ||
``` |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there is much of a point to making a user facing depwarn here, because on master
Rect{T}(geom)
only works if T matches the input eltype. I therefore doubt anyone relied on it. It also throws an ArgumentError lower down the line (and would create a stackoverflow with this dep warning.)For devs I think it makes more sense, because I think it's fairly likely someone would copy the syntax from GeometryBasics. And without a warning, their implementation would silently be ignored.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nvm, doesn't work. I thought for a second that
N <: Val
was working for catching literals but I don't think it actually does. Without type specifity onRect{N}(...)
this will always call the applicable branch and loop.