test__geometric_intersection.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:bezier 作者: dhermes 项目源码 文件源码
def test_quadratics_intersect_once(self):
        # NOTE: ``nodes1`` is a specialization of [0, 0], [1/2, 1], [1, 1]
        #       onto the interval [1/4, 1] and ``nodes`` is a specialization
        #       of [0, 1], [1/2, 1], [1, 0] onto the interval [0, 3/4].
        #       We expect them to intersect at s = 1/3, t = 2/3, which is
        #       the point [1/2, 3/4].
        nodes1 = np.asfortranarray([
            [0.25, 0.4375],
            [0.625, 1.0],
            [1.0, 1.0],
        ])
        nodes2 = np.asfortranarray([
            [0.0, 1.0],
            [0.375, 1.0],
            [0.75, 0.4375],
        ])
        s_val = 1.0 / 3.0
        t_val = 2.0 / 3.0
        intersections = self._call_function_under_test(nodes1, nodes2)

        # Due to round-off, the answer may be wrong by a tiny wiggle.
        self.assertEqual(intersections.shape, (1, 2))
        self.assertAlmostEqual(
            intersections[0, 0], s_val, delta=SPACING(s_val))
        self.assertEqual(intersections[0, 1], t_val)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号