コード例 #1
0
 def testLineIntersection2(self):
     normal = np.array([2, 2, 2])
     offset = np.array([0, 0, 2])
     plane = SourcePlane(normal, offset)
     lin_off = np.array([0, 0, -2])
     grad = np.array([-1, -1, -2])
     intersection = plane.line_intersection(grad, lin_off)
     self.assertListEqual(list(intersection), [1, 1, 0])
コード例 #2
0
 def testLineIntersection3(self):
     normal = np.array([0, 1, 0])
     offset = np.array([0, 5, 0])
     plane = SourcePlane(normal, offset)
     mic_loc = np.array([0, 0, 0])
     direction = np.array([-1, 1, 1])
     loc = plane.line_intersection(direction, mic_loc)
     self.assertListEqual(list(loc), [-5, 5, 5])
コード例 #3
0
 def testLineIntersection3(self):
     normal = np.array([0, 1, 0])
     offset = np.array([0, 5, 0])
     plane = SourcePlane(normal, offset)
     mic_loc = np.array([0, 0, 0])
     direction = np.array([-1, 1, 1])
     loc = plane.line_intersection(direction, mic_loc)
     self.assertListEqual(list(loc), [-5, 5, 5])
コード例 #4
0
 def testLineIntersection2(self):
     normal = np.array([2, 2, 2])
     offset = np.array([0, 0, 2])
     plane = SourcePlane(normal, offset)
     lin_off = np.array([0, 0, -2])
     grad = np.array([-1, -1, -2])
     intersection = plane.line_intersection(grad, lin_off)
     self.assertListEqual(list(intersection), [1, 1, 0])
コード例 #5
0
 def setUp(self):
     normal = np.array([0, 1, 0])
     offset = np.array([0, 5, 0])
     normal2 = np.array([0, 0, 1])
     offset2 = np.array([0, 0, 6])
     normal3 = np.array([1, 0, 0])
     offset3 = np.array([-1, 0, 0])
     self.plane1 = SourcePlane(normal, offset)
     self.plane2 = SourcePlane(normal2, offset2)
     self.plane3 = SourcePlane(normal3, offset3)
     self.planes = [self.plane1, self.plane2, self.plane3]
     pass
コード例 #6
0
 def testInvalidPlanes(self):
     normal = np.array([0, 1, 0])
     offset = np.array([0, 5, 0])
     planes = SourcePlane(offset, normal)
     mic_loc = np.array([0, 0, 0])
     cam_loc = np.array([1, 1, 1])
     self.assertRaises(ValueError, SearchSpace, mic_loc, cam_loc, planes)
コード例 #7
0
 def testInit(self):
     normal = np.array([0, 1, 0])
     offset = np.array([0, 5, 0])
     planes = [SourcePlane(offset, normal)]
     mic_loc = np.array([0, 0, 0])
     cam_loc = np.array([1, 1, 1])
     space = SearchSpace(mic_loc, cam_loc, planes)
コード例 #8
0
 def testGetSourceLoc2PlaneBehind(self):
     normal2 = np.array([0, 0, 1])
     offset2 = np.array([0, 0, -1])
     planes = [self.plane1, SourcePlane(normal2, offset2)]
     mic_loc = np.array([0, 0, 0])
     cam_loc = np.array([1, 1, 1])
     space = SearchSpace(mic_loc, cam_loc, planes)
     direction = np.array([-1, 1, 1])
     loc = space.get_source_loc(direction)
     self.assertListEqual(list(loc), [-5, 5, 5])
コード例 #9
0
 def testValidSetup(self):
     normal = np.array([1, 2, 3])
     offset = np.array([3, 1, 1])
     plane = SourcePlane(normal, offset)