I want to measure the area of a model as if it was in 2d, for example if I had a 3d model of a car how could I measure the frontal area? In this measurement things like the length of the bonnet would not matter, it is literally as if counting the black pixels in this image assuming I could know how much area a pixel was and that the windscreen and lights were included in the count.
3 Answers
Here's a Geometry Nodes solution. It lets you select the direction you wanna flatten the object in to get an outline of it, and displays the face area in the spreadsheet under the Viewer Node > Face section.
It scales the geometry to 0
in the preferred direction, and creates a circle around the now flattened geometry. Then, it extrudes the flattened geometry to make sure raycasting will work reliably and moves all points of the circle inwards until they hit something, resulting in a clean, single-face outline of the mesh.
It is not perfect: it depends on the resolution of the circle (which is exposed as a setting in the modifier window), and it also assumes the object is one continuous mesh, but these might not be too big of a deal for most use cases like yours.
As Gorgious points out, concave parts of the geometries can stay hidden from the rays as well. In the case of a car, that seems to cause problem with the wheels, for instance:
-
$\begingroup$ My method exactly.. too late.. I wonder if there's a way of picking up holes? Also, I've been thinking about an incremental shrink, resampling a shrinking curve at each step. $\endgroup$– Robin Betts ♦Commented Mar 24, 2022 at 11:45
-
1$\begingroup$ Maybe using Mesh Islands to repeat the same process for each? (Do we need loops for that?) $\endgroup$– KuboåCommented Mar 24, 2022 at 11:46
-
$\begingroup$ Smart ! Although it isn't reliable on concave objects i.sstatic.net/fqYUl.png $\endgroup$– GorgiousCommented Mar 24, 2022 at 12:47
-
$\begingroup$ Yeah, in the case of the car it seem to be a problem for wheels: i.imgur.com/zS8fXPd.png I'm sure there are more corner cases where it'd come short. Workbench's (solid view) outline feature works so nicely, I wonder if that's accessible by Python or something? Maybe it's a screen-space/pixels thing so not viable for drawing a mesh...? Not a programmer so I'm just talking. $\endgroup$– KuboåCommented Mar 24, 2022 at 13:24
if your model is aligned to the axis, you could do it like this:
bounding box "wraps" the smallest box around your object. With the viewer you can now check your x/y/z values in the spreadsheet: