示例#1
0
文件: test_ray.py 项目: RazerM/Pyrr
 def test_create_from_line(self):
     result = ray.create_from_line([
         [0.,10.,0.],
         [10.,10.,0.]
     ])
     np.testing.assert_almost_equal(result, [[0.,10.,0.],[1.,0.,0.]], decimal=5)
     self.assertTrue(result.dtype == np.float)
示例#2
0
 def test_create_from_line(self):
     result = ray.create_from_line([[0., 10., 0.], [10., 10., 0.]])
     np.testing.assert_almost_equal(result, [[0., 10., 0.], [1., 0., 0.]],
                                    decimal=5)
     self.assertTrue(result.dtype == np.float)
示例#3
0
文件: test_ray.py 项目: jstasiak/Pyrr
    def test_create_from_line( self ):
        result = ray.create_from_line(
            numpy.array(
                [
                    [ 0.0, 0.0, 0.0 ],
                    [10.0, 0.0, 0.0 ]
                    ],
                dtype = numpy.float
                )
            )

        self.assertEqual(
            result[ 0 ][ 0 ],
            0.0,
            "Create ray from line incorrect"
            )
        self.assertEqual(
            result[ 0 ][ 1 ],
            0.0,
            "Create ray from line incorrect"
            )
        self.assertEqual(
            result[ 0 ][ 2 ],
            0.0,
            "Create ray from line incorrect"
            )
        # length should be normalised
        self.assertEqual(
            result[ 1 ][ 0 ],
            1.0,
            "Create ray from line incorrect"
            )
        self.assertEqual(
            result[ 1 ][ 1 ],
            0.0,
            "Create ray from line incorrect"
            )
        self.assertEqual(
            result[ 1 ][ 2 ],
            0.0,
            "Create ray from line incorrect"
            )

        result = ray.create_from_line(
            numpy.array(
                [
                    [ 0.0,10.0, 0.0 ],
                    [10.0,10.0, 0.0 ]
                    ],
                dtype = numpy.float
                )
            )

        self.assertEqual(
            result[ 0 ][ 0 ],
            0.0,
            "Create ray from line incorrect"
            )
        self.assertEqual(
            result[ 0 ][ 1 ],
            10.0,
            "Create ray from line incorrect"
            )
        self.assertEqual(
            result[ 0 ][ 2 ],
            0.0,
            "Create ray from line incorrect"
            )
        # length should be normalised
        self.assertEqual(
            result[ 1 ][ 0 ],
            1.0,
            "Create ray from line incorrect"
            )
        self.assertEqual(
            result[ 1 ][ 1 ],
            0.0,
            "Create ray from line incorrect"
            )
        self.assertEqual(
            result[ 1 ][ 2 ],
            0.0,
            "Create ray from line incorrect"
            )