(self)
| 268 | rtResult = rtTester.RegressionTest(0.05) |
| 269 | |
| 270 | def testClipOnNormal(self): |
| 271 | eg = vtkEnSightGoldReader() |
| 272 | eg.SetCaseFileName(VTK_DATA_ROOT + "/Data/EnSight/elements.case") |
| 273 | eg.Update() |
| 274 | |
| 275 | rs = vtkDataSetRegionSurfaceFilter() |
| 276 | rs.SetInputConnection(eg.GetOutputPort()) |
| 277 | rs.Update() |
| 278 | |
| 279 | n = vtkPPolyDataNormals() |
| 280 | n.SetInputConnection(rs.GetOutputPort()) |
| 281 | n.Update() |
| 282 | |
| 283 | pl = vtkPlane() |
| 284 | pl.SetOrigin(3.5, 3.5, 0.5) |
| 285 | pl.SetNormal(0, 0, 1) |
| 286 | |
| 287 | c = vtkTableBasedClipDataSet() |
| 288 | c.SetInputConnection(n.GetOutputPort()) |
| 289 | c.SetClipFunction(pl) |
| 290 | c.SetInsideOut(1) |
| 291 | |
| 292 | c.Update() |
| 293 | data = c.GetOutputDataObject(0).GetBlock(0) |
| 294 | |
| 295 | normals_points = data.GetPointData().GetNormals() |
| 296 | |
| 297 | idList = vtkIdList() |
| 298 | # get the point id from the cell, because the point order is not deterministic |
| 299 | data.GetCellPoints(9, idList) |
| 300 | [x, y, z] = normals_points.GetTuple3(idList.GetId(0)) |
| 301 | self.assertEqual(x, 0) |
| 302 | self.assertEqual(y, 0) |
| 303 | self.assertEqual(z, 1) |
| 304 | |
| 305 | # get the point id from the cell, because the point order is not deterministic |
| 306 | data.GetCellPoints(61, idList) |
| 307 | [x, y, z] = normals_points.GetTuple3(idList.GetId(0)) |
| 308 | self.assertEqual(x, 0.8944272994995117) |
| 309 | self.assertEqual(y, 0.44721364974975586) |
| 310 | self.assertEqual(z, 0.) |
| 311 | |
| 312 | if __name__ == "__main__": |
| 313 | Testing.main([(TestClip, 'test')]) |
nothing calls this directly
no test coverage detected