Exemple #1
0
 def test_non_intersection1(self):
     """ckeck intersection de deux segments parallèles"""
     A = (0., 0.)
     B = (1., 2.)
     C = (3., 0.)
     D = (4., 2.)
     assert(intersection((A, B), (C, D)) is None)
Exemple #2
0
 def test_intersection1(self):
     """ckeck intersection d'un segment vertical et un segment horizontal"""
     A = (0., 0.)
     B = (0., 2.)
     C = (-1., 1.)
     D = (1., 1.)
     assert(intersection((A, B), (C, D)) == (0, 1))
Exemple #3
0
 def test_intersection2(self):
     """ckeck intersection de deux segments quelconques sécants"""
     A = (0., 0.)
     B = (2., 2.)
     C = (0., 2.)
     D = (2., 0.)
     assert(intersection((A, B), (C, D)) == (1, 1))
Exemple #4
0
 def test_non_intersection2(self):
     """ckeck intersection de deux segments non sécants
     apprtenant à deux droites séquentes"""
     A = (0., 0.)
     B = (0., 1.)
     C = (-1., 2.)
     D = (1., 2.)
     K = intersection((A, B), (C, D))
     assert(K is not None)
     assert(not sur_segment(K, (A, B)) or not sur_segment(K, (C, D)))
Exemple #5
0
 def test_convexe(self):
     """ test si un quadrilatere convexe est reconnu
     """
     A = (1., 3.)
     B = (2., 4.)
     C = (5., 0.)
     D = (0., 1.)
     diag1 = (A, C)
     diag2 = (B, D)
     K = intersection(diag1, diag2)
     assert(K is not None)
     assert(sur_segment(K, diag1))
     assert(sur_segment(K, diag2))
     assert(convexe(A, B, C, D))