Esempio n. 1
0
 def test_point_collision(self):
     self.assertTrue(
         self.obs._collision_point(pos.Pos(np.array([2, 0, 0]))),
         "testing point collision")
     self.assertFalse(
         self.obs._collision_point(pos.Pos(np.array([1, 0, 0]))),
         "testing point collision")
Esempio n. 2
0
 def direction(self):
     """
     unit vector of direction
     :return: Position
     """
     len = self.length()
     if len == 0.0:
         uvec = pos.Pos(np.transpose(np.array([0, 0, 0])))
     else:
         uvec = pos.Pos(np.transpose(np.array([(self.end.x - self.start.x) / len,
                                               (self.end.y - self.start.y) / len,
                                               (self.end.z - self.start.z) / len])))
     return uvec
Esempio n. 3
0
 def test_scalarprod(self):
     self.assertEqual(self.scalarprod, pos.Pos(np.array([3, 6, 9])),
                      "scalar product test")
     self.assertEqual(self.scalarprod, 3 * self.point,
                      "scalar product test")
Esempio n. 4
0
 def test_diff(self):
     self.assertEqual(self.diff, pos.Pos(np.array([3, 3, 3])),
                      "difference test")
Esempio n. 5
0
 def test_sum(self):
     self.assertEqual(self.sum, pos.Pos(np.array([5, 7, 9])), "sum test")
Esempio n. 6
0
 def test_eq(self):
     self.assertEqual(self.point, pos.Pos(np.array([1, 2, 3])),
                      "equality test")
Esempio n. 7
0
 def setUp(self):
     self.point = pos.Pos(np.array([1, 2, 3, 4]))
     self.otherpt = pos.Pos(np.array([4, 5, 6, 7]))
     self.sum = self.point + self.otherpt
     self.diff = self.otherpt - self.point
     self.scalarprod = self.point * 3
Esempio n. 8
0
 def test_pos(self):
     self.assertEqual(self.obs.position, pos.Pos(np.array([1, 2, 3])), "testing position of obstacle")
Esempio n. 9
0
 def setUp(self):
     self.obs = DummyObs(pos.Pos(np.array([1, 2, 3])), np.array([1]))
     self.pos = pos.Pos(np.array([4, 5, 6]))
     self.seg = seg.Seg(pos.Pos(np.array([1, 1, 1])), pos.Pos(np.array([2, 2, 3])))
Esempio n. 10
0
 def test_direction(self):
     self.assertEqual(self.seg1.direction(), pos.Pos(np.array([0, 1, 0])),
                      "unit vector test")
     self.assertEqual(self.seg2.direction(), pos.Pos(np.array([0, 1, 0])),
                      "unit vector test")
Esempio n. 11
0
 def test_end(self):
     self.assertEqual(self.seg1.end, pos.Pos(np.array([1, 1, 0])),
                      "end point access test")
Esempio n. 12
0
 def test_start(self):
     self.assertEqual(self.seg1.start, pos.Pos(np.array([1, 0, 0])),
                      "starting point access test")
Esempio n. 13
0
 def setUp(self):
     self.seg1 = seg.Seg(pos.Pos(np.array([1, 0, 0])),
                         pos.Pos(np.array([1, 1, 0])))
     self.seg2 = seg.Seg(pos.Pos(np.array([1, 0, 1])),
                         pos.Pos(np.array([1, 1, 1])))
Esempio n. 14
0
 def test_collision(self):
     self.assertTrue(self.obs.collision_check(self.nc_path),
                     "testing collision")
     self.assertFalse(
         self.obs.collision_check(pos.Pos(np.array([1, 0, 0]))),
         "testing collision")
Esempio n. 15
0
 def setUp(self):
     self.obs = obs.RoundObs(pos.Pos(np.array([0, 0, 0])), 1.0)
     self.nc_path = seg.Seg(pos.Pos(np.array([2, 0, 0])),
                            pos.Pos(np.array([2, 2, 0])))
     self.c_path = seg.Seg(pos.Pos(np.array([-1, 0, 0])),
                           pos.Pos(np.array([1, 0, 0])))
Esempio n. 16
0
 def setUp(self):
     self.obs = obs.CylObs(pos.Pos(np.array([0, 0, 0])), 1.0)
     self.nc_path = seg.Seg(pos.Pos(np.array([2, 0, 0])), pos.Pos(np.array([2, 2, 0])))
     p1 = pos.Pos(np.array([-1.03, -0.1566, 1.10]))
     p2 = pos.Pos(np.array([1.094, 0.29, 1.22]))
     self.c_path = seg.Seg(p1, p2)