I have a lot of calculations I need to do on meshes using global coordinates (distances between vertices, surface areas regions, etc.), and my script is getting slow. I am wondering if there are any useful strategies to avoid having to constantly re-multiply vertex coordinates by matrix_world every time I need to loop over a set of vertices. For example, it would be great if there were an "operate in world coordinates" mode, or a way to convert all local coordinates to their global coordinates.
# loop outline that is performed often mat1 = ob1.matrix_world mat2 = ob2.matrix_world for v1_ind in verts1: v1 = mat1 * ob1.data.vertices[v1_ind].co for v2_ind in verts2: v2 = mat2 * ob2.data.vertices[v2_ind].co # computations
Further, is a way to use Blender's polygon.area to obtain the area of a face in global coordinates, or do I have to calculate it myself using the global coordinates of each vertex defining the face (slower)?