trimMapper = vtk.vtkPolyDataMapper() trimMapper.SetInputConnection(sampleImp.GetOutputPort(0)) trimMapper.ScalarVisibilityOff() trimActor = vtk.vtkActor() trimActor.SetMapper(trimMapper) trimActor.GetProperty().SetColor(0, 0, 1) # Build a loop from the clipper buildLoops = vtk.vtkContourLoopExtraction() buildLoops.SetInputConnection(sampleImp.GetOutputPort(0)) buildLoops.CleanPointsOn() buildLoops.Update() # Test passing cell data imprint0 = vtk.vtkImprintFilter() imprint0.SetTargetConnection(pd2cd.GetOutputPort()) imprint0.SetImprintConnection(buildLoops.GetOutputPort()) imprint0.SetOutputTypeToImprintedRegion() imprint0.BoundaryEdgeInsertionOn() imprint0.SetTolerance(0.0001) imprint0.SetMergeTolerance(0.0005) if coloring == 0: imprint0.PassCellDataOff() imprint0.PassPointDataOff() else: imprint0.PassCellDataOn() imprint0.PassPointDataOff() timer = vtk.vtkTimerLog() timer.StartTimer()
target.SetStartTheta(0) target.SetEndTheta(90) imprint = vtk.vtkSphereSource() imprint.SetRadius(radius) imprint.SetCenter(0, 0, 0) imprint.LatLongTessellationOn() imprint.SetThetaResolution(8 * res) imprint.SetPhiResolution(4 * res) imprint.SetStartTheta(12) imprint.SetEndTheta(57) imprint.SetStartPhi(60.0) imprint.SetEndPhi(120.0) # Produce an imprint imp = vtk.vtkImprintFilter() imp.SetTargetConnection(target.GetOutputPort()) imp.SetImprintConnection(imprint.GetOutputPort()) imp.SetOutputTypeToProjectedImprint() imp.SetTolerance(0.085) imp.Update() impMapper = vtk.vtkPolyDataMapper() impMapper.SetInputConnection(imp.GetOutputPort()) impMapper.SetScalarRange(0, 2) impMapper.SetScalarModeToUseCellFieldData() impMapper.SelectColorArray("ImprintedCells") impActor = vtk.vtkActor() impActor.SetMapper(impMapper) impActor.GetProperty().SetColor(1, 0, 0)
plane2.SetXResolution(2 * res) plane2.SetYResolution(2 * res) plane2.SetOrigin(2.25, 2.25, 0) plane2.SetPoint1(7.25, 2.25, 0) plane2.SetPoint2(2.25, 7.25, 0) xForm = vtk.vtkTransform() xForm.RotateZ(-25) xForm.Translate(-1.5, 1.5, 0) xFormF = vtk.vtkTransformPolyDataFilter() xFormF.SetInputConnection(plane2.GetOutputPort()) xFormF.SetTransform(xForm) # Output candidate target cells imp = vtk.vtkImprintFilter() imp.SetTargetConnection(target.GetOutputPort()) imp.SetImprintConnection(xFormF.GetOutputPort()) imp.SetTolerance(0.001) imp.SetOutputTypeToTargetCells() imp.Update() targetMapper = vtk.vtkPolyDataMapper() targetMapper.SetInputConnection(imp.GetOutputPort()) targetActor = vtk.vtkActor() targetActor.SetMapper(targetMapper) targetActor.GetProperty().SetRepresentationToWireframe() targetActor.GetProperty().SetColor(0, 1, 0) imprintMapper = vtk.vtkPolyDataMapper()