def test_seg_contains(self): sb = SegmentedBelt() SOL.add(sb.num_segs >= 2) SOL.add(sb.segment(0).contains(Point2D(5, 2))) SOL.add(sb.segment(1).contains(Point2D(10, 5))) SOL.add(sb.segment(0).horizontal()) SOL.model() c1 = SOL.eval(sb.corner(1)) self.assertEqual(c1, Point2D(10,2))
def test_intersecting_segbelt_and_dseg(self): sb = SegmentedBelt() SOL.add(sb.corner(0) == Point2D(0, 0)) SOL.add(sb.corner(1) == Point2D(10, 0)) SOL.add(sb.sink() == Point2D(20, 0)) SOL.add(sb.num_segs >= 2) ds = Segment(Point2D(), Point2D(), is_diag=True) SOL.add(ds.p1 == Point2D(12, 0)) SOL.add(ds.p2 == Point2D(15, 3)) SOL.add(non_intersecting_seg_belt_diag_seg(sb, ds)) d = None for d in SOL.shrinker_loop(sb.num_segs): pass self.assertEqual(4, d)