And write it into an obj file which looks correct.
I was now wondering on how I would go on extracting normals from polyData? I found nothing in the documentation about normals.
I know I could get the normal of a face via: vtkTriangle.computeNormal(v1, v2, v3, n);.
Would this be the best way to go about this?
Or is there a way to extract the normals from the polyData?
The best my be to store normals on points instead of cells. You can get those with the vtkPolyDataNormals filter. Then you can get the point normals with polyData.getPointData().getNormals().getData()
Should you want normals on cells instead, the best would be to improve vtkPolyDataNormals (PR is welcomed) to conditionally compute the normals on the cells (not just the normals of the points as it is right now).
Then you would then be able to get the normals from polyData.getCellData().getNormals().getData().