Calculating building surface area according to axes or angles

Hi, I’m trying to get the user to draw and assemble a structure as I have shown in the pictures. However, I want to calculate the surface area occupied by this created shape in the X and Z axes (or a certain angle). There are simple shapes now, but I’m thinking of adding more different ones.

In the picture below, I tried to show it with a yellow dashed scanned area as an example. How should I go about calculating this area?

And also is possible to calculate the two boxes surface area separately?

Thanks

Example Playground: https://playground.babylonjs.com/#6XIT28#1327

Hi @hepter and welcome to the community. I am a little unclear about what you need.

Do you need the surface area of
1 all sides parallel to a plane? or
2 all sides parallel to a plane that have the same normal (perpendicular) to the plane.

Assuming it is 2 you could

A create your plane Plane | Babylon.js Documentation
B extract the normal from the plane, plane.normal
C Extract the positions and index data from the mesh Updating Vertices | Babylon.js Documentation
D Obtain the normal for each facet triangle of the mesh Facet Data | Babylon.js Documentation
E Where the facet normal is close enough to the plane normal obtain from the indices obtain the vertex positions of each facet triangle of the mesh and use them to calculate the area of the facet triangle
F Sum relevant surface areas.

You may find this page which calculates the full surface area of a mesh helpful Mesh Surface Area | Babylon.js Documentation

1 Like

Hello @hepter just checking in, was your question answered?