-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(geometry): is_clockwise() now works as expected for a disv problem (
#1374) * fix(geometry): is_clockwise() now works as expected for a disv problem * new test asserts a failure for a counter-clockwise set of vertices. Ran black on new test script
- Loading branch information
1 parent
8ae9b4d
commit 3a1d94a
Showing
2 changed files
with
34 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import flopy | ||
import numpy as np | ||
|
||
|
||
def test_does_isclockwise_work(): | ||
# Create some points | ||
verts = [] | ||
verts.append([0, 20.0000, 30.0000]) | ||
verts.append([1, 18.9394, 25.9806]) | ||
verts.append([2, 21.9192, 25.3013]) | ||
verts.append([3, 22.2834, 27.5068]) | ||
|
||
# List the points above in counter-clockwise order | ||
iv = [0, 0, 1, 2, 3] | ||
|
||
# Organize the previous info into lists of x an y data | ||
xv, yv = [], [] | ||
xyverts = [] | ||
for v in iv[1:]: | ||
tiv, txv, tyv = verts[v] | ||
xv.append(txv) | ||
yv.append(tyv) | ||
|
||
# is_clockwise() should fail and return false | ||
rslt = flopy.utils.geometry.is_clockwise(xv, yv) | ||
|
||
assert bool(rslt) is False, "is_clockwise() failed" | ||
|
||
|
||
if __name__ == "__main__": | ||
test_does_isclockwise_work() |
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