sphere.py 文件源码

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

项目:s2sphere 作者: sidewalklabs 项目源码 文件源码
def get_directed_hausdorff_distance(self, other):
        if other.contains(self):
            return 0.0
        if other.is_empty():
            return math.pi

        other_complement_center = other.get_complement_center()
        if self.contains(other_complement_center):
            return self.__class__.positive_distance(other.hi(),
                                                    other_complement_center)
        else:
            if self.__class__(other.hi(), other_complement_center) \
                    .contains(self.hi()):
                hi_hi = self.__class__.positive_distance(other.hi(), self.hi())
            else:
                hi_hi = 0

            if self.__class__(other_complement_center, other.lo()) \
                    .contains(self.lo()):
                lo_lo = self.__class__.positive_distance(self.lo(), other.lo())
            else:
                lo_lo = 0

            assert hi_hi > 0 or lo_lo > 0
            return max(hi_hi, lo_lo)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号