Making STL frontal area calculations easier

Nathan Rooy | March 26, 2021

Introduction

When working with aerodynamic properties such as drag, it’s common practice to normalize these values against some sort of reference area. For most ground vehicles with a pressure dominated drag contribution this ends up being the cross-sectional area as seen from the front (or projected onto the inlet plane). Most of the time, acquiring these values is pretty easy, especially if you’re dealing with some nice clean CAD files. Annoyingly though, sometimes all you have are the non-parametric, triangulated geometry (STL) files. Either way, you only have a few options (Blender, ParaView, etc..) and they’re all fairly tedious, time consuming, and not as precise as it could be. This is an annoying bottleneck which is further exacerbated in fast paced work environments such as motorsport. Because of this, I wrote a simple CLI called pArea which aims to reduce this process down to a single command.

Example usage

As a simple use case, let’s determine the frontal area of some old LMP geometry I had laying around. They started out as IGES files and were exported as STLs via NETGEN. Here’s a clay rendering to get an idea of what it looks like (pretend like I didn’t forget to include the body panel latches…).

le mans stl vehicle geometry

First step is to install pArea using PyPi, so open a terminal and slap in the following:

pip install parea

Next, call parea and specify the geometry. In this case it’s an a collection of STL files so I’m using -stl along with a shell-style wildcard * to capture them. Lastly, I’m specifying the direction in which I want the projected area (I could have specified the projection plane -yz instead).

parea -stl *.stl -x

Which yields a value of 1.7139905… units2. In this case, the STL base units are meters which makes the area m2. If you’re looking for geometry to test, I included a simple cube STL [link].

Final thoughts

I originally wrote this out in C with plans wrap it in Python, but ended up on just porting everything to Python. Because of this, it’s not as fast as I would like. If you end up using pArea and think it’s too slow, open up an issue on GitHub or reach out to me! While completing the initial C based version of pArea, I ended up reading a few good books along the way which really helped:

The second book I have listed: Computational Geometry in C by Joseph O’Rourke is an especially good book and anyone interested in geometry/algorithms will likely enjoy it. Thanks for reading!

- Nathan

p-area frontal area calculator logo