当前位置: 首页 > news >正文

临沂地区建站网站网站开发市场

临沂地区建站网站,网站开发市场,企业邮箱注册哪家好,价格低廉本文 以 Python 语言开发 我们在做三维软件开发时,经常会用到相机坐标轴,来指示当前空间位置; 坐标轴效果: 相机方向坐标轴 Cube 正方体坐标轴 自定义坐标轴: Code: Axes def main():colors vtkNamedC…

本文 以 Python 语言开发

我们在做三维软件开发时,经常会用到相机坐标轴,来指示当前空间位置;

坐标轴效果:

相机方向坐标轴

 Cube 正方体坐标轴

 自定义坐标轴:

Code:

Axes
def main():colors = vtkNamedColors()# create a SpheresphereSource = vtkSphereSource()sphereSource.SetCenter(0.0, 0.0, 0.0)sphereSource.SetRadius(0.5)# create a mappersphereMapper = vtkPolyDataMapper()sphereMapper.SetInputConnection(sphereSource.GetOutputPort())# create an actorsphereActor = vtkActor()sphereActor.SetMapper(sphereMapper)# a renderer and render windowrenderer = vtkRenderer()renderWindow = vtkRenderWindow()renderWindow.SetWindowName('Axes')renderWindow.AddRenderer(renderer)# an interactorrenderWindowInteractor = vtkRenderWindowInteractor()renderWindowInteractor.SetRenderWindow(renderWindow)# add the actors to the scenerenderer.AddActor(sphereActor)renderer.SetBackground(colors.GetColor3d('SlateGray'))transform = vtkTransform()transform.Translate(1.0, 0.0, 0.0)axes = vtkAxesActor()#  The axes are positioned with a user transformaxes.SetUserTransform(transform)# properties of the axes labels can be set as follows# this sets the x axis label to redaxes.GetXAxisCaptionActor2D().GetCaptionTextProperty().SetColor(colors.GetColor3d('Red'));# the actual text of the axis label can be changed:axes.SetXAxisLabelText('test')renderer.AddActor(axes)renderer.GetActiveCamera().Azimuth(50)renderer.GetActiveCamera().Elevation(-30)renderer.ResetCamera()renderWindow.SetWindowName('Axes')renderWindow.Render()# begin mouse interactionrenderWindowInteractor.Start()if __name__ == '__main__':main()
CameraOrientationWidget
def main():colors = vtkNamedColors()renderer = vtkRenderer()ren_win = vtkRenderWindow()interactor = vtkRenderWindowInteractor()sphere_source = vtkSphereSource()sphere_source.SetRadius(10.0)mapper = vtkPolyDataMapper()mapper.SetInputConnection(sphere_source.GetOutputPort())actor = vtkActor()actor.GetProperty().SetColor(colors.GetColor3d('Beige'))actor.SetMapper(mapper)renderer.AddActor(actor)renderer.SetBackground(colors.GetColor3d('DimGray'))ren_win.AddRenderer(renderer)ren_win.SetSize(600, 600)ren_win.SetWindowName('CameraOrientationWidget')# Important: The interactor must be set prior to enabling the widget.interactor.SetRenderWindow(ren_win)cam_orient_manipulator = vtkCameraOrientationWidget()cam_orient_manipulator.SetParentRenderer(renderer)# Enable the widget.cam_orient_manipulator.On()ren_win.Render()interactor.Initialize()interactor.Start()if __name__ == "__main__":main()
OrientationMarkerWidget
   colors = vtkNamedColors()# create a rendering window and rendererren = vtkRenderer()ren_win = vtkRenderWindow()ren_win.AddRenderer(ren)ren_win.SetWindowName('OrientationMarkerWidget')# create a renderwindowinteractoriren = vtkRenderWindowInteractor()iren.SetRenderWindow(ren_win)cube = vtkCubeSource()cube.SetXLength(200)cube.SetYLength(200)cube.SetZLength(200)cube.Update()cm = vtkPolyDataMapper()cm.SetInputConnection(cube.GetOutputPort())ca = vtkActor()ca.SetMapper(cm)ca.GetProperty().SetColor(colors.GetColor3d("BurlyWood"))ca.GetProperty().EdgeVisibilityOn()ca.GetProperty().SetEdgeColor(colors.GetColor3d("Red"))# assign actor to the rendererren.AddActor(ca)ren.SetBackground(colors.GetColor3d('CornflowerBlue'))axes_actor = vtkAnnotatedCubeActor()axes_actor.SetXPlusFaceText('L')axes_actor.SetXMinusFaceText('R')axes_actor.SetYMinusFaceText('I')axes_actor.SetYPlusFaceText('S')axes_actor.SetZMinusFaceText('P')axes_actor.SetZPlusFaceText('A')axes_actor.GetTextEdgesProperty().SetColor(colors.GetColor3d("Yellow"))axes_actor.GetTextEdgesProperty().SetLineWidth(2)axes_actor.GetCubeProperty().SetColor(colors.GetColor3d("Blue"))axes = vtkOrientationMarkerWidget()axes.SetOrientationMarker(axes_actor)axes.SetInteractor(iren)axes.EnabledOn()axes.InteractiveOn()ren.ResetCamera()# enable user interface interactoriren.Initialize()ren_win.Render()ren.GetActiveCamera().Azimuth(45)ren.GetActiveCamera().Elevation(30)ren_win.Render()iren.Start()
custom OrientationMarker
    colors = vtkNamedColors()reader = vtkXMLPolyDataReader()reader.SetFileName("./Human.vtp")icon_mapper = vtkDataSetMapper()icon_mapper.SetInputConnection(reader.GetOutputPort())icon_actor = vtkActor()icon_actor.SetMapper(icon_mapper)icon_actor.GetProperty().SetColor(colors.GetColor3d('Silver'))# Set up the renderer, window, and interactorrenderer = vtkRenderer()renderer.SetBackground(colors.GetColor3d('SlateGray'))ren_win = vtkRenderWindow()ren_win.AddRenderer(renderer)ren_win.SetSize(400, 400)ren_win.SetWindowName('OrientationMarkerWidget1')iren = vtkRenderWindowInteractor()iren.SetRenderWindow(ren_win)rgb = [0.0, 0.0, 0.0]colors.GetColorRGB('Wheat', rgb)# Set up the widgetwidget = vtkOrientationMarkerWidget()widget.SetOrientationMarker(icon_actor)widget.SetInteractor(iren)widget.SetViewport(0.0, 0.0, 0.3, 0.3)widget.SetOutlineColor(*rgb)widget.SetEnabled(1)widget.InteractiveOn()# Create a superquadricsuperquadric_source = vtkSuperquadricSource()superquadric_source.SetPhiRoundness(.001)superquadric_source.SetThetaRoundness(.04)# Create a mapper and actorsuperquadric_mapper = vtkPolyDataMapper()superquadric_mapper.SetInputConnection(superquadric_source.GetOutputPort())superquadric_actor = vtkActor()superquadric_actor.SetMapper(superquadric_mapper)superquadric_actor.GetProperty().SetInterpolationToFlat()superquadric_actor.GetProperty().SetDiffuseColor(colors.GetColor3d('Carrot'))superquadric_actor.GetProperty().SetSpecularColor(colors.GetColor3d('White'))superquadric_actor.GetProperty().SetDiffuse(0.6)superquadric_actor.GetProperty().SetSpecular(0.5)superquadric_actor.GetProperty().SetSpecularPower(5.0)renderer.AddActor(superquadric_actor)renderer.ResetCamera()ren_win.Render()iren.Initialize()iren.Start()

http://www.yayakq.cn/news/798115/

相关文章:

  • 衡水企业网站建设价格什么是网络营销?网络营销的目的有哪些内容?
  • 网站导航如何优化品牌设计开题报告
  • 网站建设和连接器区公司名字网店推广方案
  • 网站建设信息在哪儿发布山东网站建设流程
  • 市场调研报告ppt宁波企业网站seo
  • 万网提供的网站建设服务的具体项目新建的网站必须要备案吗
  • 怎么自己做网站空间网站版权信息修改
  • js模拟点击网站的按钮四川网站建设开发
  • 网页粒子效果网站网站关键词排名很好的原因
  • 双鸭山建设网站桂林网站优化
  • 中企做的网站太原网站的内容和功能
  • 怎样做商城网站洛阳网站建设找汉狮
  • 大气扁平网站在什么网站上做精帖
  • wordpress迁移跳转原网站购买服务器
  • 国外工程建筑网站网站根目录验证文件在哪里
  • 教育网站制作公司网页美工设计(第2版)
  • php网站建设思路方案物联网服务平台
  • 发果怎么做视频网站网站制作方案介绍及要求
  • 爱站工具包的模块广州市数商云网络科技有限公司
  • 关键词优化的方法有哪些惠州网站建设推荐乐云seo
  • 汕头网站建设和运营百度seo推广方案
  • 汕头定制网站建设代理一个手游需要多少钱
  • 北京金方网站设计怎么用电脑自带软件做网站页面
  • 信邦建设工程有限公司网站苏州网站建设联系苏州梦易行
  • 甘肃做网站找谁长沙市住房和建设局官方网站
  • 南京网站优樱化中企动力z云邮
  • 建设网站的账务处理电商网站管理
  • 松江网站设计武清网站建设
  • 自适应h5网站模板阜阳网站开发招聘
  • 想要给网站投稿如何做手机软件制作平台