Skip to content

Commit

Permalink
fix simple quad check
Browse files Browse the repository at this point in the history
  • Loading branch information
cjekel committed Aug 18, 2019
1 parent 41e51d7 commit 09112e2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion similaritymeasures/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.3
0.3.4
6 changes: 3 additions & 3 deletions similaritymeasures/similaritymeasures.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ def is_simple_quad(ab, bc, cd, da):
cross = np.array([temp0, temp1, temp2, temp3])
# See that cross products are greater than or equal to zero
crossTF = cross >= 0
# if the cross products are majority false, re compute the cross rpoducts
# Because they don't necesarrily need to lie in the same 'Z' direction
# if the cross products are majority false, re compute the cross products
# Because they don't necessarily need to lie in the same 'Z' direction
if sum(crossTF) <= 1:
crossTF = cross <= 0
if sum(crossTF) > 2:
if sum(crossTF) == 2:
return True
else:
return False
Expand Down
8 changes: 8 additions & 0 deletions tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@ def test_P_Q_dtw_minkowski_p3(self):
r, _ = similaritymeasures.dtw(P, Q, metric='minkowski', p=3)
self.assertTrue(r, 3.0)

def test_complex_quad(self):
a = [0., 0.]
b = [1., 1.]
c = [1., 0.]
d = [0., 1.]
quad = similaritymeasures.is_simple_quad(a, b, d, c)
self.assertFalse(quad)


if __name__ == '__main__':

Expand Down

0 comments on commit 09112e2

Please sign in to comment.