Example #1
0
    def test_create_xz(self):
        result = plane.create_xz()
        self.assertTrue(np.allclose(result, [0., 1., 0., 0.]))

        result = plane.create_xz(distance=2.)
        self.assertTrue(np.allclose(result, [0., 1., 0., 2.]))

        result = plane.create_xz(invert=True, distance=2.)
        self.assertTrue(np.allclose(result, [0., -1., 0., -2.]))
Example #2
0
    def test_point_height_above_plane(self):
        pl = plane.create([0., 1., 0.], 1.)
        p = np.array([0., 1., 0.])
        result = gt.point_height_above_plane(p, pl)
        self.assertEqual(result, 0.)

        p = np.array([0., 0., 0.])
        result = gt.point_height_above_plane(p, pl)
        self.assertEqual(result, -1.)

        v1 = np.array([ 0.0, 0.0, 1.0])
        v2 = np.array([ 1.0, 0.0, 1.0])
        v3 = np.array([ 0.0, 1.0, 1.0])
        p = np.array([0.0, 0.0, 20.0])

        pl = plane.create_from_points(v1, v2, v3)
        pl = plane.invert_normal(pl)

        result = gt.point_height_above_plane(p, pl)
        self.assertEqual(result, 19.)

        pl = plane.create_xz(distance=5.)
        p = np.array([0., 5., 0.])
        h = gt.point_height_above_plane(p, pl)
        self.assertEqual(h, 0.)
Example #3
0
    def test_position(self):
        p = plane.create_xz(distance=-5.)
        result = plane.position(p)
        self.assertTrue(np.allclose(result, [0., -5., 0.]))

        p = plane.create_from_position(position=[0., 0., 1.],
                                       normal=[0., 0., 1.])
        self.assertTrue(np.allclose(plane.position(p), [0., 0., 1.]))
Example #4
0
 def test_normal(self):
     p = plane.create_xz(distance=5.)
     result = plane.normal(p)
     self.assertTrue(np.allclose(result, [0., 1., 0.]))
Example #5
0
 def test_position(self):
     p = plane.create_xz(distance=5.)
     result = plane.position(p)
     self.assertTrue(np.allclose(result, [0., 5., 0.]))
Example #6
0
 def test_create_xz(self):
     result = plane.create_xz()
     self.assertTrue(np.allclose(result, [0., 1., 0., 0.]))
Example #7
0
 def test_normal(self):
     p = plane.create_xz(distance=5.)
     result = plane.normal(p)
     self.assertTrue(np.allclose(result, [0.,1.,0.]))
Example #8
0
 def test_position(self):
     p = plane.create_xz(distance=5.)
     result = plane.position(p)
     self.assertTrue(np.allclose(result, [0.,5.,0.]))
Example #9
0
 def test_create_xz_invert_distance(self):
     result = plane.create_xz(invert=True, distance=2.)
     self.assertTrue(np.allclose(result, [0., -1., 0., 2.]))
Example #10
0
 def test_create_xz(self):
     result = plane.create_xz()
     self.assertTrue(np.allclose(result, [0., 1., 0., 0.]))