crossArea.py 文件源码

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

项目:Acoustics 作者: fei0324 项目源码 文件源码
def crossArea(forceVecs,triangleAreaSet,triNormVecs):

    """
    Preparation for Young's Modulus
    Calculate the cross sectional areas perpendicular to the force vectors
    Input: forceVecs = a list of force vectors
           triangleAreaSet = area of triangles
           triNormVecs = a list of normal vectors for each triangle (should be given by the stl file)
    Output: A list of cross sectional area, approximated by the area of the triangle perpendicular to the force vector
    """

    crossAreaSet = np.zeros(len(triangleAreaSet))

    for i in range(len(forceVecs)):
        costheta = np.dot(forceVecs[i],triNormVecs[i])/(np.linalg.norm(forceVecs[i])*np.linalg.norm(triNormVecs[i]))
        crossAreaSet[i] = abs(costheta*triangleAreaSet[i])

    return crossAreaSet
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号