柚子快報邀請碼778899分享:3d VTK
柚子快報邀請碼778899分享:3d VTK
vtkAxesActor
# 創(chuàng)建vtkActor對象
actor = vtk.vtkActor()
actor.SetMapper(mapper)
# 創(chuàng)建xyz軸
axes = vtk.vtkAxesActor()
axes.SetTotalLength(2*L, 2*L, 2*L)
axes.AxisLabelsOff()
axes.SetAxisLabels(1)
axes.SetShaftTypeToCylinder()
axes.SetCylinderRadius(0.001)
axes.GetXAxisShaftProperty().SetColor(0, 1, 0) #將xyz軸的桿顏色設(shè)置為綠色
axes.GetYAxisShaftProperty().SetColor(0, 1, 0) #將xyz軸的桿顏色設(shè)置為綠色
axes.GetZAxisShaftProperty().SetColor(0, 1, 0) #將xyz軸的桿顏色設(shè)置為綠色
axes.GetXAxisTipProperty().SetColor(0, 1, 0) #將xyz軸的箭頭顏色設(shè)置為綠色
axes.GetYAxisTipProperty().SetColor(0, 1, 0) #將xyz軸的箭頭顏色設(shè)置為綠色
axes.GetZAxisTipProperty().SetColor(0, 1, 0) #將xyz軸的箭頭顏色設(shè)置為綠色
vtkCubeAxesActor
使用實例:vtkCubeAxes的相關(guān)使用_vtkcubeaxesactor-CSDN博客
?
接口函數(shù)?
枚舉值
# 設(shè)置網(wǎng)格坐標軸CubeAxesActor
m_cubeAxesActor = vtk.vtkCubeAxesActor()
# #先設(shè)置相機,將相機設(shè)置為renderer的相機。這樣可將場和cubeaxesactor放在一塊
m_cubeAxesActor.SetCamera(renderer.GetActiveCamera())
m_cubeAxesActor.SetBounds(data.GetBounds()) #設(shè)置CubeAxesActor的軸線范圍是imagedata的范圍
# #軸的設(shè)置
# # #設(shè)置XYZ軸的標簽
m_cubeAxesActor.SetXTitle("X")
m_cubeAxesActor.SetYTitle("Y")
m_cubeAxesActor.SetZTitle("Z")
# # #設(shè)置XYZ軸標題和對應(yīng)的標度的顏色
m_cubeAxesActor.GetTitleTextProperty(0).SetColor(1, 0.0, 1.0)# 設(shè)置x軸的標題的顏色為
m_cubeAxesActor.GetLabelTextProperty(0).SetColor(1, 0.0, 1.0)# 設(shè)置x軸的標度label顏色
m_cubeAxesActor.GetTitleTextProperty(1).SetColor(0.0, 1.0, 0.0)
m_cubeAxesActor.GetLabelTextProperty(1).SetColor(0.0, 1.0, 0.0)
m_cubeAxesActor.GetTitleTextProperty(2).SetColor(0.5, 0.5, 1.0)
m_cubeAxesActor.GetLabelTextProperty(2).SetColor(0.5, 0.5, 1.0)
# # #設(shè)置x、y、z軸的起始和終止值
m_cubeAxesActor.SetXAxisRange(0, L)
m_cubeAxesActor.SetYAxisRange(0, L)
m_cubeAxesActor.SetZAxisRange(0, L)
# # #設(shè)置坐標軸線的寬度
m_cubeAxesActor.GetXAxesLinesProperty().SetLineWidth(0.5)
m_cubeAxesActor.GetYAxesLinesProperty().SetLineWidth(0.5)
m_cubeAxesActor.GetZAxesLinesProperty().SetLineWidth(0.5)
# # #設(shè)置標題和標簽文本的屏幕大小。默認值為10.0。
m_cubeAxesActor.SetScreenSize(10)
# # #指定標簽與軸之間的距離。默認值為20.0。
m_cubeAxesActor.SetLabelOffset(10)
# # #顯示坐標軸
m_cubeAxesActor.SetVisibility(True)
# # #指定一種模式來控制軸的繪制方式 0:外邊緣 1:最近位置 2:最遠位置
# 3:靜態(tài)最近位置,不隨攝像頭動而跳變位置 4 :靜態(tài)所有外邊緣位置,不隨攝像頭動而跳變位置。
m_cubeAxesActor.SetFlyMode(3)
# # #設(shè)置慣性因子,該慣性因子控制軸切換位置的頻率(從一個軸跳到另一個軸)
m_cubeAxesActor.SetInertia(1)
# #網(wǎng)格設(shè)置
# # #開啟x、y、z軸的網(wǎng)格線繪制
m_cubeAxesActor.DrawXGridlinesOff()
m_cubeAxesActor.DrawYGridlinesOff()
m_cubeAxesActor.DrawZGridlinesOff()
# # #設(shè)置x、y、z軸的內(nèi)部網(wǎng)格線不繪制
m_cubeAxesActor.SetDrawXInnerGridlines(0)
m_cubeAxesActor.SetDrawYInnerGridlines(0)
m_cubeAxesActor.SetDrawZInnerGridlines(0)
# # #設(shè)置x、y、z軸網(wǎng)格線的顏色
m_cubeAxesActor.GetXAxesGridlinesProperty().SetColor(0.5, 0.5, 0.5)
m_cubeAxesActor.GetYAxesGridlinesProperty().SetColor(0.5, 0.5, 0.5)
m_cubeAxesActor.GetZAxesGridlinesProperty().SetColor(0.5, 0.5, 0.5)
# # #指定網(wǎng)格線呈現(xiàn)的樣式
m_cubeAxesActor.SetGridLineLocation(2)
# #刻度的設(shè)置
# # #不顯示x、y、z軸的次刻度
m_cubeAxesActor.XAxisMinorTickVisibilityOff()
m_cubeAxesActor.YAxisMinorTickVisibilityOff()
m_cubeAxesActor.ZAxisMinorTickVisibilityOff()
# # #設(shè)置刻度標簽的顯示方式(參數(shù)1為false,刻度標簽按0-200000顯示;為true時,按0-200顯示)
m_cubeAxesActor.SetLabelScaling(0, 0, 0, 0)
# # #設(shè)置刻度線顯示的位置(內(nèi)部、外部、兩側(cè))
m_cubeAxesActor.SetTickLocation(1)
柚子快報邀請碼778899分享:3d VTK
推薦文章
本文內(nèi)容根據(jù)網(wǎng)絡(luò)資料整理,出于傳遞更多信息之目的,不代表金鑰匙跨境贊同其觀點和立場。
轉(zhuǎn)載請注明,如有侵權(quán),聯(lián)系刪除。