Beispiel #1
0
 def test_divide_by_scalar(self):
     point = Point((2, 4))
     c = 2
     self.assertEqual(point / c, Point((1, 2)))
Beispiel #2
0
 def test_add(self):
     p1 = Point((1, 2))
     p2 = Point((3, 4))
     self.assertEqual(p1 + p2, Point((4, 6)))
Beispiel #3
0
 def test_subtract(self):
     p1 = Point((1, 2))
     p2 = Point((3, 4))
     self.assertEqual(p1 - p2, Point((-2, -2)))
Beispiel #4
0
 def test_points_folded_on_self_horizontally_joint_angle(self):
     joint = (Point((0, 0)), Point((0, 1)), Point((0, 0)))
     self.assertEqualRounded(Point.joint_angle(*joint), pi)
Beispiel #5
0
 def test_y_getter(self):
     point = Point((1, 2))
     self.assertEqual(point.y, 2)
Beispiel #6
0
 def test_first_two_points_same_joint_angle(self):
     joint = (Point((1, 1)), Point((1, 1)), Point((2, 1)))
     self.assertEqualRounded(Point.joint_angle(*joint), 0)
Beispiel #7
0
 def test_all_points_same_joint_angle(self):
     joint = (Point((0, 0)), Point((0, 0)), Point((0, 0)))
     self.assertEqualRounded(Point.joint_angle(*joint), 0)
Beispiel #8
0
 def test_colinear_joint_angle(self):
     joint = (Point((1, 1)), Point((2, 1)), Point((3, 1)))
     self.assertEqualRounded(Point.joint_angle(*joint), 0)
Beispiel #9
0
 def test_right_down(self):
     joint = (Point((0, 0)), Point((1, 0)), Point((1, -1)))
     self.assertEqualRounded(Point.joint_angle(*joint), pi / 2)
Beispiel #10
0
 def test_down_left(self):
     joint = (Point((0, 0)), Point((0, -1)), Point((-1, -1)))
     self.assertEqualRounded(Point.joint_angle(*joint), pi / 2)
Beispiel #11
0
 def test_left_up(self):
     joint = (Point((0, 0)), Point((-1, 0)), Point((-1, 1)))
     self.assertEqualRounded(Point.joint_angle(*joint), pi / 2)
Beispiel #12
0
 def test_up_right(self):
     joint = (Point((0, 0)), Point((0, 1)), Point((1, 1)))
     self.assertEqualRounded(Point.joint_angle(*joint), pi / 2)