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.)
def test_point_height_above_plane(self): 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.)
def test_invert_normal( self ): p = numpy.array( [ 1.0, 0.0, 0.0, 1.0 ] ) result = plane.invert_normal( p ) expected = numpy.array( [-1.0, 0.0, 0.0, -1.0 ] ) self.assertTrue( numpy.array_equal( result, expected ), "Plane normal invert incorrect" )
def test_height_above_plane( self ): v1 = numpy.array( [ 0.0, 0.0, 1.0 ] ) v2 = numpy.array( [ 1.0, 0.0, 1.0 ] ) v3 = numpy.array( [ 0.0, 1.0, 1.0 ] ) point = numpy.array([ 0.0, 0.0, 20.0 ]) p = plane.create_from_points( v1, v2, v3 ) p = plane.invert_normal( p ) result = gt.point_height_above_plane( point, p ) # should be 19.0 expected = 19.0 self.assertEqual( result, expected, "Height above plane incorrect" )
def test_invert_normal(self): p = np.array([1.0, 0.0, 0.0, 1.0]) result = plane.invert_normal(p) self.assertTrue(np.allclose(result, [-1.0, 0.0, 0.0, -1.0]))