panel.py 文件源码

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

项目:bpy_lambda 作者: bcongdon 项目源码 文件源码
def _intersect_elipsis(self, center, radius, x):
        """ upper intersection of line parallel to y axis and an ellipsis
            where line is given by x origin
            circle by center, radius.x and radius.y semimajor and seminimor axis (half width and height) as float
            return float y of upper intersection point, float angle
        """
        dx = x - center.x
        d2 = dx * dx
        A = 1 / radius.y / radius.y
        C = d2 / radius.x / radius.x - 1
        d = - 4 * A * C
        if d <= 0:
            if x > center.x:
                return center.y, 0
            else:
                return center.y, pi
        else:
            y0 = sqrt(d) / 2 / A
            d = (radius.x * radius.x) - d2
            y = sqrt(d)
            return center.y + y0, atan2(y, dx)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号