Skip to content

Commit 35237d2

Browse files
committed
reversed input ordering
1 parent 2adc429 commit 35237d2

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/utils.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1644,12 +1644,12 @@ function LithostaticPressure!(Plithos::Array{T,N}, Density::Array{T,N}, dz::Numb
16441644
end
16451645

16461646
"""
1647-
inPolygon!(PolyX::Vector, PolyY::Vector, X::Matrix, Y::Matrix, INSIDE::Matrix; fast=false)
1647+
inPolygon!(INSIDE::Matrix, PolyX::Vector, PolyY::Vector, X::Matrix, Y::Matrix; fast=false)
16481648
16491649
Checks if points given by matrices `X` and `Y` are in or on (both cases return true) a polygon given by `PolyX` and `PolyY`. Boolean `fast` will trigger faster version that may miss points that are exactly on the edge of the polygon. Speedup is a factor of 3.
16501650
16511651
"""
1652-
function inPolygon!(PolyX::Vector{T}, PolyY::Vector{T}, X::Matrix{T}, Y::Matrix{T}, INSIDE::Matrix{Bool}; fast=false) where T <: Real
1652+
function inPolygon!(INSIDE::Matrix{Bool}, PolyX::Vector{T}, PolyY::Vector{T}, X::Matrix{T}, Y::Matrix{T}; fast=false) where T <: Real
16531653
iSteps = collect(eachindex(PolyX))
16541654
jSteps = [length(PolyX); collect(1:length(PolyX)-1)]
16551655

@@ -1669,12 +1669,12 @@ function inPolygon!(PolyX::Vector{T}, PolyY::Vector{T}, X::Matrix{T}, Y::Matrix{
16691669
end
16701670

16711671
"""
1672-
inPolygon!(PolyX::Vector, PolyY::Vector, X::Vector, Y::Vector, INSIDE::Vector; fast=false)
1672+
inPolygon!(inside::Vector, PolyX::Vector, PolyY::Vector, x::Vector, y::Vector; fast=false)
16731673
1674-
Same as above but `X`, `Y` and `INSIDE` are vectors.
1674+
Same as above but `inside`, `X` and `Y` and are vectors.
16751675
16761676
"""
1677-
function inPolygon!(PolyX::Vector{T}, PolyY::Vector{T}, x::Vector{T}, y::Vector{T}, inside::Vector{Bool}; fast=false) where T <: Real
1677+
function inPolygon!(inside::Vector{Bool}, PolyX::Vector{T}, PolyY::Vector{T}, x::Vector{T}, y::Vector{T}; fast=false) where T <: Real
16781678
iSteps = collect(eachindex(PolyX))
16791679
jSteps = [length(PolyX); collect(1:length(PolyX)-1)]
16801680

test/test_utils.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ xvec = collect(-9:0.5:9); yvec = collect(-9:0.5:9); zvec = collect(1.:1.);
247247
X,Y,Z = meshgrid(xvec, yvec, zvec)
248248
X, Y = X[:,:,1], Y[:,:,1]
249249
yN = zeros(Bool, size(X))
250-
inPolygon!(PolyX, PolyY, X, Y, yN, fast=true)
250+
inPolygon!(yN, PolyX, PolyY, X, Y, fast=true)
251251
@test sum(yN) == 194
252-
inPolygon!(PolyX, PolyY, X, Y, yN)
252+
inPolygon!(yN, PolyX, PolyY, X, Y)
253253
@test sum(yN) == 217

0 commit comments

Comments
 (0)