Esempio n. 1
0
    def test_scale_by_vector( self ):
        rect = numpy.array(
            [
                [ 5.0, 5.0],
                [10.0,10.0]
                ]
            )

        scale = [ 2.0, 3.0 ]

        result = rectangle.scale_by_vector(
            rect,
            scale
            )

        self.assertEqual(
            rect[ (0,0) ] * scale[ 0 ],
            result[ (0,0) ],
            "Failed to scale rectangle"
            )
        self.assertEqual(
            rect[ (0,1) ] * scale[ 1 ],
            result[ (0,1) ],
            "Failed to scale rectangle"
            )
        self.assertEqual(
            rect[ (1,0) ] * scale[ 0 ],
            result[ (1,0) ],
            "Failed to scale rectangle"
            )
        self.assertEqual(
            rect[ (1,1) ] * scale[ 1 ],
            result[ (1,1) ],
            "Failed to scale rectangle"
            )
Esempio n. 2
0
 def test_scale_by_vector3(self):
     result = rectangle.scale_by_vector([[-1.,-2.],[2.,4.]], [2.,3.,4.])
     np.testing.assert_almost_equal(result, [[-2.,-6.],[4.,12.]], decimal=5)
Esempio n. 3
0
 def test_scale_by_vector3(self):
     result = rectangle.scale_by_vector([[-1.,-2.],[2.,4.]], [2.,3.,4.])
     np.testing.assert_almost_equal(result, [[-2.,-6.],[4.,12.]], decimal=5)