[vtkusers] A question about vtkProgrammableSource
pagen_ivan
pagen_ivan at 163.com
Thu Oct 30 02:42:38 EST 2003
vtkusers:
Hello, I am trying to translate a 3D reconstruction programme in python to one in c++. When I use vtkProgrammbleSource to get some data for vtkSurfaceReconstructorfilter to reconstruct the surface, I get a message from msvc "vtkSurfaceReconstructionFilter (0x051210C8): No points to reconstruct". So I think there may be some mistake about my usage of setExecuteMethod. I find the programme have not carried out the function "ReadPoints()" I made. Part of my programme is showed below:
vtkProgrammableSource * PSP=vtkProgrammableSource::New();
void ReadPoints(void * PSPointer)
{
float PointsVal[10];
FILE * fp1;
PSP=(vtkProgrammableSource *) PSPointer;
vtkPolyData * OutPut=vtkPolyData::New();
vtkPoints * Points =vtkPoints::New();
fp1=fopen("data.txt","r");
rewind(fp1);
while(PointsVal[0]!=1000)
{
fscanf(fp1,"%f %f %f",PointsVal,PointsVal+1,PointsVal+2);
if(PointsVal[0]>1) break;
Points->InsertNextPoint(PointsVal[0],PointsVal[1],PointsVal[2]);
}
OutPut=PSP->GetPolyDataOutput();
OutPut->SetPoints(Points);
}
void main()
{
vtkProgrammableSource * PointSource=vtkProgrammableSource::New();
PointSource->SetExecuteMethod(ReadPoints, (void *) PointSource);//??????????
vtkSurfaceReconstructionFilter * Surf=vtkSurfaceReconstructionFilter::New();
Surf->SetInput(PSP->GetPolyDataOutput());
..............................................
.............................................
}
I have tried a lot, but I still can not get a result, could you kindly help me with this?
Thanks a lot!!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20031030/37bcc5fe/attachment.htm>
More information about the vtkusers
mailing list