开源 企业版 高校版 私有云 模力方舟 AI 队友
代码拉取完成,页面将自动刷新
加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
已有帐号? 立即登录
文件
master
分支 (6)
标签 (64)
master
nightly-master
release-6.3
dashboard
release
hooks
v8.0.1
v8.0.0
v8.0.0.rc2
v8.0.0.rc1
v7.1.1
v7.1.0
v7.1.0.rc2
v7.1.0.rc1
v7.0.0
v7.0.0.rc2
v7.0.0.rc1
v6.3.0
v6.3.0.rc2
v6.3.0-rc1
v6.3.0.rc1
v6.2.0
v6.2.0.rc1
v6.1.0
v6.1.0.rc2
v6.1.0.rc1
master
分支 (6)
标签 (64)
master
nightly-master
release-6.3
dashboard
release
hooks
v8.0.1
v8.0.0
v8.0.0.rc2
v8.0.0.rc1
v7.1.1
v7.1.0
v7.1.0.rc2
v7.1.0.rc1
v7.0.0
v7.0.0.rc2
v7.0.0.rc1
v6.3.0
v6.3.0.rc2
v6.3.0-rc1
v6.3.0.rc1
v6.2.0
v6.2.0.rc1
v6.1.0
v6.1.0.rc2
v6.1.0.rc1
克隆/下载
克隆/下载
提示
下载代码请复制以下命令到终端执行
为确保你提交的代码身份被 Gitee 正确识别,请执行以下命令完成配置
初次使用 SSH 协议进行代码克隆、推送等操作时,需按下述提示完成 SSH 配置
1 生成 RSA 密钥
2 获取 RSA 公钥内容,并配置到 SSH公钥
在 Gitee 上使用 SVN,请访问 使用指南
使用 HTTPS 协议时,命令行会出现如下账号密码验证步骤。基于安全考虑,Gitee 建议 配置并使用私人令牌 替代登录密码进行克隆、推送等操作
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # 私人令牌
master
分支 (6)
标签 (64)
master
nightly-master
release-6.3
dashboard
release
hooks
v8.0.1
v8.0.0
v8.0.0.rc2
v8.0.0.rc1
v7.1.1
v7.1.0
v7.1.0.rc2
v7.1.0.rc1
v7.0.0
v7.0.0.rc2
v7.0.0.rc1
v6.3.0
v6.3.0.rc2
v6.3.0-rc1
v6.3.0.rc1
v6.2.0
v6.2.0.rc1
v6.1.0
v6.1.0.rc2
v6.1.0.rc1
xyPlot.py 7.09 KB
一键复制 编辑 原始数据 按行查看 历史
Berk Geveci 提交于 2012年02月02日 04:47 +08:00 . Refactored vtkXYPlotActor input API.
#!/usr/bin/env python
# This example demonstrates the use of vtkXYPlotActor to display three
# probe lines using three different techniques. In this example, we
# are loading data using the vtkPLOT3DReader. We are using the
# vtkProbeFilter to extract the underlying point data along three
# probe lines.
import vtk
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
# Create a PLOT3D reader and load the data.
pl3d = vtk.vtkMultiBlockPLOT3DReader()
pl3d.SetXYZFileName(VTK_DATA_ROOT + "/Data/combxyz.bin")
pl3d.SetQFileName(VTK_DATA_ROOT + "/Data/combq.bin")
pl3d.SetScalarFunctionNumber(100)
pl3d.SetVectorFunctionNumber(202)
pl3d.Update()
pl3d_output = pl3d.GetOutput().GetBlock(0)
# Create three the line source to use for the probe lines.
line = vtk.vtkLineSource()
line.SetResolution(30)
# Move the line into place and create the probe filter. For
# vtkProbeFilter, the probe line is the input, and the underlying data
# set is the source.
transL1 = vtk.vtkTransform()
transL1.Translate(3.7, 0.0, 28.37)
transL1.Scale(5, 5, 5)
transL1.RotateY(90)
tf = vtk.vtkTransformPolyDataFilter()
tf.SetInputConnection(line.GetOutputPort())
tf.SetTransform(transL1)
probe = vtk.vtkProbeFilter()
probe.SetInputConnection(tf.GetOutputPort())
probe.SetSourceData(pl3d_output)
# Move the line again and create another probe filter.
transL2 = vtk.vtkTransform()
transL2.Translate(9.2, 0.0, 31.20)
transL2.Scale(5, 5, 5)
transL2.RotateY(90)
tf2 = vtk.vtkTransformPolyDataFilter()
tf2.SetInputConnection(line.GetOutputPort())
tf2.SetTransform(transL2)
probe2 = vtk.vtkProbeFilter()
probe2.SetInputConnection(tf2.GetOutputPort())
probe2.SetSourceData(pl3d_output)
# Move the line again and create a third probe filter.
transL3 = vtk.vtkTransform()
transL3.Translate(13.27, 0.0, 33.40)
transL3.Scale(4.5, 4.5, 4.5)
transL3.RotateY(90)
tf3 = vtk.vtkTransformPolyDataFilter()
tf3.SetInputConnection(line.GetOutputPort())
tf3.SetTransform(transL3)
probe3 = vtk.vtkProbeFilter()
probe3.SetInputConnection(tf3.GetOutputPort())
probe3.SetSourceData(pl3d_output)
# Create a vtkAppendPolyData to merge the output of the three probe
# filters into one data set.
appendF = vtk.vtkAppendPolyData()
appendF.AddInputConnection(probe.GetOutputPort())
appendF.AddInputConnection(probe2.GetOutputPort())
appendF.AddInputConnection(probe3.GetOutputPort())
# Create a tube filter to represent the lines as tubes. Set up the
# associated mapper and actor.
tuber = vtk.vtkTubeFilter()
tuber.SetInputConnection(appendF.GetOutputPort())
tuber.SetRadius(0.1)
lineMapper = vtk.vtkPolyDataMapper()
lineMapper.SetInputConnection(tuber.GetOutputPort())
lineActor = vtk.vtkActor()
lineActor.SetMapper(lineMapper)
# Create an xy-plot using the output of the 3 probe filters as input.
# The x-values we are plotting are arc length.
xyplot = vtk.vtkXYPlotActor()
xyplot.AddDataSetInputConnection(probe.GetOutputPort())
xyplot.AddDataSetInputConnection(probe2.GetOutputPort())
xyplot.AddDataSetInputConnection(probe3.GetOutputPort())
xyplot.GetPositionCoordinate().SetValue(0.0, 0.67, 0)
xyplot.GetPosition2Coordinate().SetValue(1.0, 0.33, 0) #relative to Position
xyplot.SetXValuesToArcLength()
xyplot.SetNumberOfXLabels(6)
xyplot.SetTitle("Pressure vs. Arc Length (Zoomed View)")
xyplot.SetXTitle("")
xyplot.SetYTitle("P")
xyplot.SetXRange(.1, .35)
xyplot.SetYRange(.2, .4)
xyplot.GetProperty().SetColor(0, 0, 0)
xyplot.GetProperty().SetLineWidth(2)
# Set text prop color (same color for backward compat with test)
# Assign same object to all text props
tprop = xyplot.GetTitleTextProperty()
tprop.SetColor(xyplot.GetProperty().GetColor())
xyplot.SetAxisTitleTextProperty(tprop)
xyplot.SetAxisLabelTextProperty(tprop)
# Create an xy-plot using the output of the 3 probe filters as input.
# The x-values we are plotting are normalized arc length.
xyplot2 = vtk.vtkXYPlotActor()
xyplot2.AddDataSetInputConnection(probe.GetOutputPort())
xyplot2.AddDataSetInputConnection(probe2.GetOutputPort())
xyplot2.AddDataSetInputConnection(probe3.GetOutputPort())
xyplot2.GetPositionCoordinate().SetValue(0.00, 0.33, 0)
xyplot2.GetPosition2Coordinate().SetValue(1.0, 0.33, 0) #relative to Position
xyplot2.SetXValuesToNormalizedArcLength()
xyplot2.SetNumberOfXLabels(6)
xyplot2.SetTitle("Pressure vs. Normalized Arc Length")
xyplot2.SetXTitle("")
xyplot2.SetYTitle("P")
xyplot2.PlotPointsOn()
xyplot2.PlotLinesOff()
xyplot2.GetProperty().SetColor(1, 0, 0)
xyplot2.GetProperty().SetPointSize(2)
# Set text prop color (same color for backward compat with test)
# Assign same object to all text props
tprop = xyplot2.GetTitleTextProperty()
tprop.SetColor(xyplot2.GetProperty().GetColor())
xyplot2.SetAxisTitleTextProperty(tprop)
xyplot2.SetAxisLabelTextProperty(tprop)
# Create an xy-plot using the output of the 3 probe filters as input.
# The x-values we are plotting are the underlying point data values.
xyplot3 = vtk.vtkXYPlotActor()
xyplot3.AddDataSetInputConnection(probe.GetOutputPort())
xyplot3.AddDataSetInputConnection(probe2.GetOutputPort())
xyplot3.AddDataSetInputConnection(probe3.GetOutputPort())
xyplot3.GetPositionCoordinate().SetValue(0.0, 0.0, 0)
xyplot3.GetPosition2Coordinate().SetValue(1.0, 0.33, 0) #relative to Position
xyplot3.SetXValuesToIndex()
xyplot3.SetNumberOfXLabels(6)
xyplot3.SetTitle("Pressure vs. Point Id")
xyplot3.SetXTitle("Probe Length")
xyplot3.SetYTitle("P")
xyplot3.PlotPointsOn()
xyplot3.GetProperty().SetColor(0, 0, 1)
xyplot3.GetProperty().SetPointSize(3)
# Set text prop color (same color for backward compat with test)
# Assign same object to all text props
tprop = xyplot3.GetTitleTextProperty()
tprop.SetColor(xyplot3.GetProperty().GetColor())
xyplot3.SetAxisTitleTextProperty(tprop)
xyplot3.SetAxisLabelTextProperty(tprop)
# Draw an outline of the PLOT3D data set.
outline = vtk.vtkStructuredGridOutlineFilter()
outline.SetInputData(pl3d_output)
outlineMapper = vtk.vtkPolyDataMapper()
outlineMapper.SetInputConnection(outline.GetOutputPort())
outlineActor = vtk.vtkActor()
outlineActor.SetMapper(outlineMapper)
outlineActor.GetProperty().SetColor(0, 0, 0)
# Create the Renderers, RenderWindow, and RenderWindowInteractor.
ren = vtk.vtkRenderer()
ren2 = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
renWin.AddRenderer(ren2)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
# Set the background, viewport (necessary because we want to have the
# renderers draw to different parts of the render window) of the first
# renderer. Add the outline and line actors to the renderer.
ren.SetBackground(0.6784, 0.8471, 0.9020)
ren.SetViewport(0, 0, .5, 1)
ren.AddActor(outlineActor)
ren.AddActor(lineActor)
# Set the background and viewport of the second renderer. Add the
# xy-plot actors to the renderer. Set the size of the render window.
ren2.SetBackground(1, 1, 1)
ren2.SetViewport(0.5, 0.0, 1.0, 1.0)
ren2.AddActor2D(xyplot)
ren2.AddActor2D(xyplot2)
ren2.AddActor2D(xyplot3)
renWin.SetSize(500, 250)
# Set up the camera parameters.
cam1 = ren.GetActiveCamera()
cam1.SetClippingRange(3.95297, 100)
cam1.SetFocalPoint(8.88908, 0.595038, 29.3342)
cam1.SetPosition(-12.3332, 31.7479, 41.2387)
cam1.SetViewUp(0.060772, -0.319905, 0.945498)
iren.Initialize()
renWin.Render()
iren.Start()
Loading...
举报
举报成功
我们将于2个工作日内通过站内信反馈结果给你!
请认真填写举报原因,尽可能描述详细。
请选择举报类型
取消
发送
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

简介

Mirror of Visualization Toolkit repository
暂无标签
BSD-3-Clause
使用 BSD-3-Clause 开源许可协议
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
编辑仓库简介
简介内容
主页
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/devstone/VTK.git
git@gitee.com:devstone/VTK.git
devstone
VTK
VTK
master
点此查找更多帮助

搜索帮助

评论
仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册

AltStyle によって変換されたページ (->オリジナル) /