Click here to Skip to main content
15,887,267 members
Please Sign up or sign in to vote.
1.00/5 (6 votes)
See more:
C#
#include "vtkActor.h"
#include "vtkCastToConcrete.h"
#include "vtkDataSetMapper.h"
#include "vtkLookupTable.h"
#include "vtkPolyDataNormals.h"
#include "vtkPolyDataReader.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkRenderer.h"
#include "vtkVectorDot.h"
#include "vtkWarpVector.h"
int main(int argc, char **argv)
{
 // Create the RenderWindow, Renderer and both Actors
//
vtkRenderer *ren1 = vtkRenderer::New();
vtkRenderWindow *renWin = vtkRenderWindow::New();
renWin->AddRenderer(ren1);
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
iren->SetRenderWindow(renWin);
// read a vtk file
//
vtkPolyDataReader *plate = vtkPolyDataReader::New();
plate->SetFileName("../../../vtkdata/plate.vtk");
plate->SetVectorsName("mode8");
vtkWarpVector *warp = vtkWarpVector::New();
warp->SetInput(plate->GetOutput());
warp->SetScaleFactor(0.5);
vtkCastToConcrete *caster = vtkCastToConcrete::New();
caster->SetInput(warp->GetOutput());
vtkPolyDataNormals *normals = vtkPolyDataNormals::New();
normals->SetInput(caster->GetPolyDataOutput());
vtkVectorDot *color = vtkVectorDot::New();
color->SetInput(normals->GetOutput());
vtkLookupTable *lut = vtkLookupTable::New();
lut->SetNumberOfColors(256);
lut->Build();
for (int i; 0<i<128;i++)
eval->lut(SetTableValue(i), expr->(128.0-i)/128.0()expr->(128.0-i)/128.0()expr->(128.0-i)/128.0()1);
for (int i; 128<i<256;i++}
eval->lut(SetTableValue(i), expr->(i-128.0)/128.0()expr->(i-128.0)/128.0()expr->(i-128.0)/128.0()1);

vtkDataSetMapper *plateMapper = vtkDataSetMapper::New();
plateMapper->SetInput(color->GetOutput());
plateMapper->SetLookupTable(lut);
plateMapper->SetScalarRange(-1, 1);
vtkActor *plateActor = vtkActor::New();
plateActor->SetMapper(plateMapper);
// Add the actors to the renderer, set the background and size
//
ren1->AddActor(plateActor);
ren1->SetBackground(1, 1, 1);
renWin->SetSize(500, 500);
// render the image
//
iren->SetUserMethod({wm, deiconify, .vtkInteract});
iren->Initialize();
//renWin SetFileName "dispPlot.tcl.ppm"
//renWin SaveImageAsPPM
// prevent the tk window from showing up then start the event loop
return 0;
}
Posted
Updated 9-Apr-10 3:26am
v2

A compiler could tell you a couple of things about your code. And once it is happy, all it really means is the syntax is OK; the program itself could still be utter crap.

nmatulionis wrote:
for (int i; 0< i<128;i++)
...
for (int i; 128< i<256;i++}


Basically the same mistake, does that count for 1 or for 2?

:)
 
Share this answer
 
Wow. Down from 6 to 5. You need to be more specific.
 
Share this answer
 
I never knew that we have 'Find error without Compiler' competition on CodeProject :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900