Esempio n. 1
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)
Esempio n. 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)
Esempio n. 3
0
    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"
            )