utils.py 文件源码

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

项目:UPBGE-CommunityAddon 作者: elmeunick9 项目源码 文件源码
def vectorFrom2Points(origin, dest, module = None):
    """ Returns a |Vector|  form 2 points in the space.

    :param origin: Point A
    :type origin: |Vector|
    :param dest: Point B
    :type dest: |Vector|
    :param float module: If setted, the returned vector will have this maxium lenght. The new lenght will never be greater than the original.
    """
    vec = Vector((dest.x - origin.x, dest.y - origin.y, dest.z - origin.z))
    if not module: return vec

    l = vec.length

    if l < 0.0125: return vec.zero()
    if l < module: return vec

    vec = vec / l
    if module == 1: return vec
    else: return vec * module
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号