Calculate volume based on STL file
Just wondering if anyone had a simple, efficient way of calculating the volume of a stereolithographic 开发者_如何学Cfile (STL)? And rendering this in a Windows Form Control?
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.
精彩评论