electrostatics.py 文件源码

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

项目:electrostatics 作者: tomduck 项目源码 文件源码
def is_left(x0, x1, x2):
    """Returns True if x0 is left of the line between x1 and x2,
    False otherwise.  Ref: https://stackoverflow.com/questions/1560492"""
    assert x1.shape == x2.shape == (2,)
    matrix = array([x1-x0, x2-x0])
    if len(x0.shape) == 2:
        matrix = matrix.transpose((1, 2, 0))
    return det(matrix) > 0
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号