sphere.py 文件源码

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

项目:s2sphere 作者: sidewalklabs 项目源码 文件源码
def intersects(self, *args):
        if len(args) == 1 and isinstance(args[0], CellId):
            cell_id = args[0]
            index = bisect.bisect_left(self.__cell_ids, cell_id)
            if index != len(self.__cell_ids) and \
               self.__cell_ids[index].range_min() <= cell_id.range_max():
                return True
            return (
                index != 0 and
                self.__cell_ids[index - 1].range_max() >= cell_id.range_min()
            )
        elif len(args) == 1 and isinstance(args[0], CellUnion):
            cell_union = args[0]
            for cell_id in cell_union.__cell_ids:
                if self.intersects(cell_id):
                    return True
            return False
        else:
            raise NotImplementedError()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号