主要利用vtkMassProperties。注意:因为只能处理三角面片 的polydata,需要在pipline中前置vtkTriangleFilter,将polydata转换成tiangle mesh的polydata才能接vtkMassProperties。
vtkTriangleFilter triF= new vtkTriangleFilter();
triF.SetInput(ClipData.GetOutput());
vtkMassProperties polygonProperties = new vtkMassProperties();
polygonProperties.SetInput(triF.GetOutput());
polygonProperties.Update();
double area = polygonProperties.GetSurfaceArea();
double vol = polygonProperties.GetVolume();
MessageBox.Show("Data area is:" +area.ToString() +"/nData volume is: "+ vol.ToString());
polygonProperties.Dispose();
triF.Dispose();