diff --git a/similaritymeasures/VERSION b/similaritymeasures/VERSION index 1c09c74..42045ac 100644 --- a/similaritymeasures/VERSION +++ b/similaritymeasures/VERSION @@ -1 +1 @@ -0.3.3 +0.3.4 diff --git a/similaritymeasures/similaritymeasures.py b/similaritymeasures/similaritymeasures.py index 99f8607..fefb758 100644 --- a/similaritymeasures/similaritymeasures.py +++ b/similaritymeasures/similaritymeasures.py @@ -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 diff --git a/tests/tests.py b/tests/tests.py index 7dbbb81..d3fd4fb 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -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__':