예제 #1
0
    def test_subdivide_cubic_check_evaluate(self):
        # Use a fixed seed so the test is deterministic and round
        # the nodes to 8 bits of precision to avoid round-off.
        nodes = utils.get_random_nodes(shape=(4, 2), seed=990077, num_bits=8)

        curve = self._make_one(nodes, 3)
        self.assertEqual(curve.degree, 3)
        self._subdivide_points_check(curve)
예제 #2
0
    def test_subdivide_quartic_check_evaluate(self):
        # Use a fixed seed so the test is deterministic and round
        # the nodes to 8 bits of precision to avoid round-off.
        nodes = utils.get_random_nodes(
            shape=(15, 2), seed=741002, num_bits=8)

        klass = self._get_target_class()
        surface = klass.from_nodes(nodes)
        self.assertEqual(surface.degree, 4)
        self._subdivide_points_check(surface)
예제 #3
0
    def test_subdivide_dynamic_subdivision_matrix(self):
        degree = 4
        shape = (degree + 1, 2)
        # Use a fixed seed so the test is deterministic and round
        # the nodes to 8 bits of precision to avoid round-off.
        nodes = utils.get_random_nodes(shape=shape, seed=103, num_bits=8)

        curve = self._make_one(nodes, degree)
        self.assertEqual(curve.degree, degree)
        self._subdivide_points_check(curve)
예제 #4
0
    def test_subdivide_on_the_fly(self):
        # Test for a degree where the subdivision is done on the fly
        # rather than via a stored matrix.
        nodes = utils.get_random_nodes(
            shape=(21, 2), seed=446, num_bits=8)
        # Use a fixed seed so the test is deterministic and round
        # the nodes to 8 bits of precision to avoid round-off.

        klass = self._get_target_class()
        surface = klass.from_nodes(nodes)
        self.assertEqual(surface.degree, 5)
        self._subdivide_points_check(surface)
예제 #5
0
 def test_unsupported_degree(self):
     degree = 5
     nodes = utils.get_random_nodes(
         shape=(degree + 1, 2), seed=77618, num_bits=8)
     with self.assertRaises(NotImplementedError):
         self._call_function_under_test(nodes)