Exemple #1
0
 def test_horizontal_line(self):
     line_seg = self.create_line_segment((2, 2), (5, 2))
     self.assertEquals(interpolate_within_line_segment(line_seg, 3), 2.0)
     self.assertEquals(interpolate_within_line_segment(line_seg, 3.5), 2)
Exemple #2
0
 def test_at_start(self):
     line_seg = self.create_line_segment((2, 2), (4, 4))
     self.assertEquals(interpolate_within_line_segment(line_seg, 2), 2)
Exemple #3
0
 def test_vertical_line(self):
     line_seg = self.create_line_segment((2, 2), (2, 4))
     self.assertEquals(interpolate_within_line_segment(line_seg, 2), 3)
Exemple #4
0
 def test_line_left_up(self):
     line_seg = self.create_line_segment((2, 2), (-2, 4))
     self.assertEquals(interpolate_within_line_segment(line_seg, 0.5), 2.75)
Exemple #5
0
 def test_line_left_down(self):
     line_seg = self.create_line_segment((2, 2), (-2, 0))
     self.assertEquals(interpolate_within_line_segment(line_seg, 0.5), 1.25)
     self.assertEquals(interpolate_within_line_segment(line_seg, 1), 1.5)
Exemple #6
0
 def test_line_right_up(self):
     line_seg = self.create_line_segment((1, 1), (5, 3))
     self.assertEquals(interpolate_within_line_segment(line_seg, 2.5), 1.75)
     self.assertEquals(interpolate_within_line_segment(line_seg, 2), 1.5)
Exemple #7
0
 def test_line_right_down(self):
     line_seg = self.create_line_segment((1, 1), (5, -1))
     self.assertEquals(interpolate_within_line_segment(line_seg, 2), 0.5)
 def test_vertical_line(self):
     line_seg = self.create_line_segment((2, 2), (2, 4))
     self.assertEquals(interpolate_within_line_segment(line_seg, 2), 3)
 def test_horizontal_line(self):
     line_seg = self.create_line_segment((2, 2), (5, 2))
     self.assertEquals(interpolate_within_line_segment(line_seg, 3), 2.0)
     self.assertEquals(interpolate_within_line_segment(line_seg, 3.5), 2)
 def test_at_start(self):
     line_seg = self.create_line_segment((2, 2), (4, 4))
     self.assertEquals(interpolate_within_line_segment(line_seg, 2), 2)
 def test_line_left_down(self):
     line_seg = self.create_line_segment((2, 2), (-2, 0))
     self.assertEquals(interpolate_within_line_segment(line_seg, 0.5), 1.25)
     self.assertEquals(interpolate_within_line_segment(line_seg, 1), 1.5)
 def test_line_left_up(self):
     line_seg = self.create_line_segment((2, 2), (-2, 4))
     self.assertEquals(interpolate_within_line_segment(line_seg, 0.5), 2.75)
 def test_line_right_down(self):
     line_seg = self.create_line_segment((1, 1), (5, -1))
     self.assertEquals(interpolate_within_line_segment(line_seg, 2), 0.5)
 def test_line_right_up(self):
     line_seg = self.create_line_segment((1, 1), (5, 3))
     self.assertEquals(interpolate_within_line_segment(line_seg, 2.5), 1.75)
     self.assertEquals(interpolate_within_line_segment(line_seg, 2), 1.5)