手机网站有什么要求,做网站那种布局好,网站登录注册做验证码的目地,财务公司网站源码一#xff1a;主要的知识点
1、说明
本文只是教程内容的一小段#xff0c;因博客字数限制#xff0c;故进行拆分。主教程链接#xff1a;vtk教程——逐行解析官网所有Python示例-CSDN博客
2、知识点纪要
本段代码主要涉及的有①vtkWarpVector基于向量的形变 二#xf…一主要的知识点1、说明本文只是教程内容的一小段因博客字数限制故进行拆分。主教程链接vtk教程——逐行解析官网所有Python示例-CSDN博客2、知识点纪要本段代码主要涉及的有①vtkWarpVector基于向量的形变二代码及注释import vtkmodules.vtkRenderingOpenGL2 import vtkmodules.vtkInteractionStyle from vtkmodules.vtkCommonColor import vtkNamedColors from vtkmodules.vtkCommonCore import vtkPoints, vtkDoubleArray from vtkmodules.vtkCommonDataModel import vtkCellArray, vtkLine, vtkPolyData from vtkmodules.vtkFiltersGeneral import vtkWarpVector from vtkmodules.vtkRenderingCore import ( vtkActor, vtkPolyDataMapper, vtkRenderWindow, vtkRenderWindowInteractor, vtkRenderer ) def main(): colors vtkNamedColors() points vtkPoints() points.InsertNextPoint(0.0, 0.0, 0.0) points.InsertNextPoint(1.0, 0.0, 0.0) points.InsertNextPoint(2.0, 0.0, 0.0) points.InsertNextPoint(3.0, 0.0, 0.0) points.InsertNextPoint(4.0, 0.0, 0.0) lines vtkCellArray() line vtkLine() line.GetPointIds().SetId(0, 0) line.GetPointIds().SetId(1, 1) lines.InsertNextCell(line) line.GetPointIds().SetId(0, 1) line.GetPointIds().SetId(1, 2) lines.InsertNextCell(line) line.GetPointIds().SetId(0, 2) line.GetPointIds().SetId(1, 3) lines.InsertNextCell(line) line.GetPointIds().SetId(0, 3) line.GetPointIds().SetId(1, 4) lines.InsertNextCell(line) warpData vtkDoubleArray() warpData.SetNumberOfComponents(3) warpData.SetName(warpData) warp [0.0, 0.0, 0.0] warpData.InsertNextTuple(warp) warp[1] 0.1 warpData.InsertNextTuple(warp) warp[1] 0.3 warpData.InsertNextTuple(warp) warp[1] 0.0 warpData.InsertNextTuple(warp) warp[1] 0.1 warpData.InsertNextTuple(warp) polydata vtkPolyData() polydata.SetPoints(points) polydata.SetLines(lines) polydata.GetPointData().AddArray(warpData) polydata.GetPointData().SetActiveVectors(warpData.GetName()) vtkWarpVector 是 VTK 里一个非常实用的 形变滤波器 可以根据数据集中每个点的向量值vector data来移动点的位置 warpVector vtkWarpVector() warpVector.SetInputData(polydata) warpVector.Update() mapper vtkPolyDataMapper() mapper.SetInputData(warpVector.GetPolyDataOutput()) actor vtkActor() actor.SetMapper(mapper) renderer vtkRenderer() renderer.AddActor(actor) renderer.SetBackground(colors.GetColor3d(cobalt_green)) renderWindow vtkRenderWindow() renderWindow.AddRenderer(renderer) renderWindow.SetWindowName(WarpVector) renderWindowInteractor vtkRenderWindowInteractor() renderWindowInteractor.SetRenderWindow(renderWindow) renderWindow.Render() renderWindowInteractor.Start() if __name__ __main__: main()