Пример #1
0
def intersect(l1, l2):
    """ returns True if linesegments l1 and l2 intersect. False otherwise."""
    # Z muss 1 sein!
    g1 = Gerade(HomVec3(l1[0][0], l1[0][1], 1, 1), HomVec3(l1[1][0], l1[1][1], 1, 1))
    g2 = Gerade(HomVec3(l2[0][0], l2[0][1], 1, 1), HomVec3(l2[1][0], l2[1][1], 1, 1))
    c = g1.schnittpunkt2D(g2)
    return c is not None
Пример #2
0
 def test_schneide(self):
     g1 = Gerade(HomVec3(1.5, 3, 0, 1), HomVec3(4.5, 3, 0, 1))
     g2 = Gerade(HomVec3(3, 1.5, 0, 1), HomVec3(3, 4.5, 0, 1))
     s = g1.schnittpunkt2D(g2)
     self.assertEqual(3.0, s.x)
     self.assertEqual(3.0, s.y)
     self.assertEqual(0.0, s.z)
     self.assertEqual(1.0, s.w)