I have a requirement to calculate the diameter and length of a pipe that was created in another tool and loaded using its geometry (not created using any ThreeJS helper (cylinder, Tube etc.))
The pipes can have different angles and dimensions. With luck (X, Y and Z aligned) it’s AABB can be used to easily calculate do the calculations, but it is not the case in several situations.
My current approach is to try to reorient the pipe to fit, perfectly inside and AABB so I could calculate it. I am using trying to use raycasting from the center of the AABB in X,Y and Z direction (up to the bounding box boundary), detecting the point it touches the pipe and trying to detect the angle that I am planning to use to rotate the pipe.
My questions is: is this approach feasible? and how can I rotate the BufferGeometry around its center? I am trying to rotate the geometry as I may need to export it later with the fixed orientation.