2

これは簡単なことのように見えますが、さまざまな色の平面でさまざまなスカラー値を表現するのが難しいです。季節のデータ「dados_solo.vtk」を含み、土壌の温度「soilTemp」に対応するスカラー値を持つファイルがあり、季節ごとに土壌の温度のデータを異なる色で表す必要があります飛行機。vtkStructuredGridGeometryFilter で問題なく表現できましたが、ポイントではなく平面で表現する必要があります。

画像

これが私がこれまでに持っているコードです:

    package require vtk
    package require vtkinteraction

vtkRenderer ren1
vtkRenderWindow renWin
    renWin AddRenderer ren1
vtkRenderWindowInteractor iren
    iren SetRenderWindow renWin

# Definir o estilo de interacção 
vtkInteractorStyleTrackballCamera style
    iren SetInteractorStyle style

    iren AddObserver UserEvent {wm deiconify .vtkInteract}

vtkDataSetReader reader
    reader SetFileName "dados_solo.vtk"
    reader SetScalarsName soilTemp
    reader Update

vtkDataSetReader readertemp
    readertemp SetFileName "dados_solo.vtk"
    readertemp SetScalarsName soilTemp
    readertemp Update

# Contours of the grid-----------------------------------------------------
vtkStructuredGridOutlineFilter outline
    outline SetInput [reader GetStructuredGridOutput]
vtkPolyDataMapper mapOutline
    mapOutline SetInput [outline GetOutput]
vtkActor outlineActor
    outlineActor SetMapper mapOutline
    [outlineActor GetProperty] SetColor 1 0 0


# Points of Grid-----------------------------------------------------
vtkStructuredGridGeometryFilter compPlane
    compPlane SetInput [reader GetStructuredGridOutput]

vtkPolyDataMapper planeMapper
    planeMapper SetInput [compPlane GetOutput]
    eval planeMapper SetScalarRange \
      [[[[reader GetOutput] GetPointData] GetScalars] GetRange]
    planeMapper ScalarVisibilityOn

vtkActor planeActor
    planeActor SetMapper planeMapper
    [planeActor GetProperty] SetColor 0 1 0

# -------------------------------------------------------------------
vtkPlane plane
    eval plane SetOrigin [[reader GetOutput] GetCenter]

vtkCutter planeCut
    planeCut SetInput [reader GetOutput]
    planeCut SetCutFunction plane

vtkPolyDataMapper cutMapper
    cutMapper SetInput [planeCut GetOutput]
    eval cutMapper SetScalarRange \
      [[[[reader GetOutput] GetPointData] GetScalars] GetRange]

vtkActor cutActor
    cutActor SetMapper cutMapper
# -------------------------------------------------------------------

ren1 AddActor cutActor 
ren1 AddActor outlineActor
ren1 AddActor planeActor
renWin SetSize 500 500
ren1 SetBackground 0.1 0.1 0.1
renWin Render
4

0 に答える 0