Exemplo n.º 1
0
 def test_create_from_points(self):
     # the biggest should be 5,5,5
     result = sphere.create_from_points([
         [ 0.0, 0.0, 0.0 ],
         [ 5.0, 5.0, 5.0 ],
         [ 0.0, 0.0, 5.0 ],
         [-5.0, 0.0, 0.0 ],
     ])
     # centred around 0,0,0
     # with MAX LENGTH as radius
     np.testing.assert_almost_equal(result, [0.,0.,0., 8.66025], decimal=5)
Exemplo n.º 2
0
 def test_create_from_points(self):
     # the biggest should be 5,5,5
     result = sphere.create_from_points([
         [0.0, 0.0, 0.0],
         [5.0, 5.0, 5.0],
         [0.0, 0.0, 5.0],
         [-5.0, 0.0, 0.0],
     ])
     # centred around 0,0,0
     # with MAX LENGTH as radius
     np.testing.assert_almost_equal(result, [0., 0., 0., 8.66025],
                                    decimal=5)
Exemplo n.º 3
0
    def test_create_from_points( self ):
        vecs = numpy.array(
            [
                [ 0.0, 0.0, 0.0 ],
                [ 5.0, 5.0, 5.0 ],
                [ 0.0, 0.0, 5.0 ],
                [-5.0, 0.0, 0.0 ],
                ],
            dtype = numpy.float
            )
        # the biggest should be 5,5,5
        result = sphere.create_from_points( vecs )

        # centred around 0,0,0
        # with MAX LENGTH as radius
        lengths = vector.length( vecs )
        expected = numpy.array( [ 0.0, 0.0, 0.0, lengths.max() ] )

        self.assertTrue(
            numpy.array_equal( result, expected ),
            "Sphere not calculated correctly"
            )