Exemplo n.º 1
0
    def test_designated_initializer(self):

        # test
        surface = enneper.Surface(CTRL_PNTS, KNOTS_U, KNOTS_V)
        np.testing.assert_equal(surface.ctrl_pnts, CTRL_PNTS)
        np.testing.assert_equal(surface.knots_u, KNOTS_U)
        np.testing.assert_equal(surface.knots_v, KNOTS_V)
Exemplo n.º 2
0
    def test_from_surface_constructor(self):

        # construct test obj_to_serialize
        original = enneper.Surface(CTRL_PNTS, KNOTS_U, KNOTS_V)

        # test
        copy = enneper.Surface.from_surface(original)
        np.testing.assert_equal(original.ctrl_pnts, copy.ctrl_pnts)
        np.testing.assert_equal(original.knots_u, copy.knots_u)
        np.testing.assert_equal(original.knots_v, copy.knots_v)
        self.assertIsNot(original.ctrl_pnts, copy.ctrl_pnts)
        self.assertIsNot(original.knots_u, copy.knots_u)
        self.assertIsNot(original.knots_v, copy.knots_v)
Exemplo n.º 3
0
    def test_export(self):

        # construct test obj_to_serialize
        file_like_obj = cStringIO.StringIO()
        surface = enneper.Surface(CTRL_PNTS, KNOTS_U, KNOTS_V)
        surface.export(file_like_obj)
        file_like_obj.seek(0)
        obj_to_serialize = json.load(file_like_obj)
        file_like_obj.close()

        # test
        np.testing.assert_equal(obj_to_serialize['ctrl_pnts'], CTRL_PNTS)
        np.testing.assert_equal(obj_to_serialize['knots_u'], KNOTS_U)
        np.testing.assert_equal(obj_to_serialize['knots_u'], KNOTS_U)
Exemplo n.º 4
0
    def test_evaluate_at(self):

        # test
        surface = enneper.Surface(CTRL_PNTS, KNOTS_U, KNOTS_V)
        np.testing.assert_equal(surface.evaluate_at(0, 0), [0, 0, 1, 1])
Exemplo n.º 5
0
    def test_deg_property(self):

        surface = enneper.Surface(CTRL_PNTS, KNOTS_U, KNOTS_V)
        self.assertEqual(surface.deg_u, DEG_U)
        self.assertEqual(surface.deg_v, DEG_V)