public vtkPolyData GetvtkFromOff()
{
StreamReader offreader = new StreamReader(MyClass.StaticAppInfo.yagenyajingoff);
offreader.ReadLine();
string[] vs = new string[3];
vs = offreader.ReadLine().Split(' ');
int number_of_points = Int32.Parse(vs[0]);
int number_of_triangles = Int32.Parse(vs[1]);
int number_of_lines = Int32.Parse(vs[2]);
vtkPoints points = new vtkPoints();
points.SetNumberOfPoints(number_of_points);
for (int i = 0; i < number_of_points; i++)
{
var ss = offreader.ReadLine().Split(' ');
points.SetPoint(i, Double.Parse(ss[0]), Double.Parse(ss[1]), Double.Parse(ss[2]));
}
vtkCellArray polys = new vtkCellArray();
int n = 3, type;
for (int i = 0; i < number_of_triangles; i++)
{
var sss = offreader.ReadLine().Split(' ');//4元素
polys.InsertNextCell(n);
for (int j = 1; j <= 3; j++)
{
type = Int32.Parse(sss[j]);
polys.InsertCellPoint(type);
}
}
vtkPolyData lastdata = new vtkPolyData();
lastdata.SetPoints(points);
lastdata.SetPolys(polys);
return lastdata;
}