# Get average shape from 10k + files

We have a ton of ergonomic data in STL files. We would like to use that data to define a basic shape for our designs. So what i am looking for an algorithm or software solution that is able to scan the data and calculate an average shape. I have looked into generative design but that doesnt seem to be what im looking for.

Do you guys know of any way to tackle my problem?

Also, if this is the wrong place to be asking these questions, im very sorry! Could you point me the right way?

Bonus points: It would be great if it shows which files are further away from the 50th percentile and which are further towards the 1st and 99th percentile.

• interesting question. Are they all scaled and oriented in a consistent way vs coordinate system? May 10, 2021 at 15:11
• @PeteW has an important point. You may be able to use Mathematica or similar programs to analyze the data.
– jko
May 10, 2021 at 15:39
• In addition to Pete's concerns: Same origin and units? May 10, 2021 at 17:47
• I'm guessing the answer will be a custom script and a LOT of complicated math.
– Drew
May 10, 2021 at 20:40
• I would caution against using averages to create a baseline. You may create an average human that represents almost no one. May 10, 2021 at 22:24

hmm. here's a shot in the dark. might require relatively simple surface. this is crude, the are much more sophisticated ways. research metric or distance for 3D shapes.

(1) In a 3D modeling tool, fit a simplified (curvature never too small) convex dummy surface to a typical data surface. Shrink it maybe 50% in a 3D tool, so it is always "inside" the data surfaces. Adjust so it's still convex. Call this shrunken preliminary reference surface R.

(2) Generate list of n evenly spaced points on R, call them vectors A_n. Also generate corresponding vectors N_n normal to R at A_n, and pointing outward. So you have a list of reference "rays" in space originating at A_n, direction N_n. Call these B_n. (note: May be helpful to have more densely spaced points A_n where R has smaller radius of curvature.)

(3) For each of m data set items, call them surfaces S_m: generate vectors C_m,n , defined by the intersection of S_m and B_n. Depending on surfaces you may have to do something to make sure there is only one intersection (eg use the one nearest to A_n looking outward). This is where concave could be an issue. Anyway, you can then use the C_m,n to construct the metric, loosely speaking. The average (or trimmed mean or minimum or whatever) surface, consisting of points D_n can then be constructed from the list C_m,n by simply applying the statistic to the list of |C_m,n| indexed by each n ... you could likewise hopefully use it as a metric.

You can superpose the black and white pixelated photos of your shapes assigning a grayscale value of $$1/n * (1/255) \ ,$$ per shape. you will get an image with a black core and shading to gray and feathering to white.

Many photo editing softwares allow you to define a border based on the gray intensity. In your case, it is 127-128.

If some parts of your objects are essential and need to be preserved you can set them to 0.

# Edit

I remembered my airplane mechanic talking about ultrasound testing equipment to check for fatigue cracks.

here is a do it yourself ultrasound 3d scanner.

3d ultrasound scanner

• And do this programmatically for all slices thru the object, like a 3D printer? May 10, 2021 at 21:34
• Yes Janathan, there is already video game software that does create explosion effects, 3d dynamic tracing, it's amazing. May 11, 2021 at 0:29
• Thanks for your reply, I think I understand what you mean. Is there a way to automate the slicing of the objects? We have upwards of 10k objects which we can use for this research. May 11, 2021 at 7:38
• One option would be to use numpy-stl for this. May 11, 2021 at 9:30