MCPcopy Create free account
hub / github.com/Kitware/VTK / testClipOnNormal

Method testClipOnNormal

Filters/General/Testing/Python/tableBasedClip.py:270–310  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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
312if __name__ == "__main__":
313 Testing.main([(TestClip, 'test')])

Callers

nothing calls this directly

Calls 15

SetCaseFileNameMethod · 0.80
GetBlockMethod · 0.80
GetTuple3Method · 0.80
vtkPlaneClass · 0.50
vtkIdListClass · 0.50
UpdateMethod · 0.45
SetInputConnectionMethod · 0.45
GetOutputPortMethod · 0.45
SetOriginMethod · 0.45
SetNormalMethod · 0.45
GetOutputDataObjectMethod · 0.45
GetNormalsMethod · 0.45

Tested by

no test coverage detected