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
评论列表
文章目录