test_curve.py 文件源码

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

项目:bezier 作者: dhermes 项目源码 文件源码
def _intersect_helper(self, **kwargs):
        # 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.
        nodes_left = np.asfortranarray([
            [0.25, 0.4375],
            [0.625, 1.0],
            [1.0, 1.0],
        ])
        left = self._make_one(nodes_left, 2)

        nodes_right = np.asfortranarray([
            [0.0, 1.0],
            [0.375, 1.0],
            [0.75, 0.4375],
        ])
        right = self._make_one(nodes_right, 2)

        result = left.intersect(right, **kwargs)
        expected = np.asfortranarray([[1.0, 2.0]]) / 3.0
        self.assertTrue(
            np.allclose(result, expected, atol=0.0, rtol=0.5**52))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号