Just wondering if anyone had a simple, efficient way of calculating the volume of a stereolithographic file (STL)? And rendering this in a Windows Form Control?
Asked
Active
Viewed 2,772 times
1 Answers
2
Well, you can take every triangle and project it to the XY plane, giving you a triangular-prism. Add the volume of this prism to your total if the triangle runs CCW, and subtract that volume if it runs clockwise. That will give you the volume of your solid, assuming it's valid STL.
Or... do the HxWxL of your bounding box: it's really 1) simple and 2) efficient, although it can be slightly inaccurate.

erjiang
- 44,417
- 10
- 64
- 100
-
1did you really suggested that he calculates volume by doing HWL multiplication of the bounding box? What happens if the shape is a pyramid? That would be more than 30% innacurate. Correct me if im wrong. – nicholaswmin Oct 29 '13 at 09:01
-
Yeah, you're wrong :) It would be a lot more than 30% inaccurate. For a rectangular pyramid, the volume is 1/3 HWL, so 66% lower than HWL. Even more if the base of the pyramid is not aligned with one of the coordinate system's planes. – erjiang Nov 07 '13 at 16:33