2

This looks like something simple to do but I am having difficulty in representing different scalar values in different colored planes. I have a file that contains the data of the seasons "dados_solo.vtk" and has the scalar value corresponding to the temperature of the soil "soilTemp", and I have to represent the data of temperature of the soil for each season in different colored planes. I had no trouble representing them with vtkStructuredGridGeometryFilter, but now I have to represent in planes, instead of points.

img

Here is the code I have so far:

    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
Cœur
  • 37,241
  • 25
  • 195
  • 267
Vitor
  • 145
  • 1
  • 1
  • 5
  • I've done the inlining; don't know how to answer the question though (I don't know 3D rendering really, and definitely not vtk). – Donal Fellows Oct 21 '13 at 08:29

0 Answers0