So this script iterates over all the selected edges of the current object and show the longest one's length (you have to look at the console to view the message).
It also writes the maximum frequency that can be calculated using the BEM according to a paper by Brian Katz:
$$f_{max} = \frac{c}{6 \times edge_{max}}$$
import bpy sound_speed = 343.0 obj = bpy.context.active_object edges = obj.data.edges vertices = obj.data.vertices matrix = obj.matrix_world.copy() mm = 0.0 for ee in edges: vv = ee.vertices v1 = matrix * vertices[ee.vertices[0]].co v2 = matrix * vertices[ee.vertices[1]].co mm = max((v1-v2).length, mm) max_freq = sound_speed / (6 * mm) print("Longest edge's length: %f"%mm) print("fmax: %f"%max_freq)
No comments:
Post a Comment