[vtkusers] Drawing complex 3D surface.
XViz
D_E at ukr.net
Mon Sep 17 17:25:55 EDT 2007
Hello everyone,
I started to work with VTK because it is much faster and powerfull than TeeChart8 I used before. But VTK is more complex, so I'll be very thankful if somebody could advise me how to complete the task described bellow.
I've got a task to build isosurfaces from images that intersect ech other: the seccond plane is inclined on 5 degrees to the first, the third to 5 degrees to the seccond and so on - for 360 degrees. So I have cyinder fill with planes. All planes consist from rectangular grid of float type points. I converted this data to unstructured points (actually I can convert it to complex structured grid, but I don't see how could it help me - I didn't mannage to visualisate even two separate cylinders). The isosurface I need to visualizate will consist from many connected/unconnected region. I tried many filters, look through both VTK books and many examples, but I cannot plot it ! :(
With vtkSurfaceReconstructionFilter it is something very strange and not right. The only thing that workes is to manully set unstructured grid from points with close intencity value and then put it to vtkGaussianSplatter ant plot it like in finance.cxx example. But it is not real picture, because all points are shrinked by vtkGaussianSplatter.
Here is the code I assume should work to draw my data (unfortunatelly in doesn't - I don't know why):
// Pl3D[i].x(,y,z,V) - is my point number i - x,y,z - coordinates, V - values - all float type. This array I did manually before.
vtkPoints *points = vtkPoints::New();
vtkIntArray *newScalars = vtkIntArray::New();
// Then I fill arrays with point and scalars in the loop incrising id for both arrays for each new point
int po=0;
for (int i=0; i<NumFull; i++)
// If I want to set manually intencity for single surface I put here: if (Pl3D[i].V>LowLevel && Pl3D[i].V<HighLevel)
{ points->InsertPoint(po,Pl3D[i].x,Pl3D[i].y,Pl3D[i].z);
newScalars->InsertValue(po,Pl3D[i].V);
po++;
};
vtkUnstructuredGrid *PdataSet = vtkUnstructuredGrid::New();
PdataSet->SetPoints(points);
PdataSet->GetPointData()->SetScalars(newScalars);
//I putted here different filters, but everithing (but vtkGaussianSplatter) didn't work
vtkContourFilter *cf = vtkContourFilter::New();
cf->SetInputConnection(someFilter->GetOutputPort());
//I tried to change SetValue for GenerateValues, or to set all values in newScalars=1 and SetValue(0,1)
cf->SetValue(0,0.0);
vtkPolyDataMapper *map = vtkPolyDataMapper::New();
map->SetInputConnection(cf->GetOutputPort());
vtkActor *popActor = vtkActor::New();
popActor->SetMapper(map);
As I wrote I tried to set all Scalar values for manyally selected iso-points to 1, or didn't set it. I tried to put my points to vtkPolyData->SetPoints() and use some filters...
I'm trying to get this thing working for two weeks already. :(
It will be very nice if somebody could help me!
Thank you very much!
XViz, D_E at ukr.net
2007-09-17
More information about the vtkusers
mailing list