[vtkusers] vtk 3D object construction from points
Alam, Mohammed
malam at med.wayne.edu
Sat Mar 15 21:23:34 EDT 2008
Hi All,
I am trying to construct and display a VTK objects from points. My
points are 8 points of Cube.
0,0,0
0,10,0
10,10,0
10,0,0
0,0,10
0,10,10
10,10,10
10,0,10
However the object constructed is nothing like a cube. Please help.
Vtkpolydata pd_orig = new vtkPolyData();
pd_orig.SetPoints(newp);
pd_orig.SetVerts(newv);
vtkSurfaceReconstructionFilter surf = new
vtkSurfaceReconstructionFilter();
surf.SetInput(pd_orig);
//surf.GetReleaseDataFlag();
vtkContourFilter cont = new vtkContourFilter();
cont.SetInput(surf.GetOutput());
cont.SetValue(0, 0.0);
vtkReverseSense rev = new vtkReverseSense();
rev.SetInput(cont.GetOutput());
rev.ReverseCellsOn();
rev.ReverseNormalsOn();
vtkSmoothPolyDataFilter smoother = new
vtkSmoothPolyDataFilter();
smoother.SetInput(rev.GetOutput());
smoother.SetNumberOfIterations(50);
vtkPolyDataNormals normals = new vtkPolyDataNormals();
normals.SetInput(smoother.GetOutput());
normals.FlipNormalsOn();
vtkPolyDataMapper mapper1 = new vtk.vtkPolyDataMapper();
mapper1.SetInput(normals.GetOutput());
vtkActor polyActor1 = new vtk.vtkActor();
polyActor1.SetMapper(mapper1);
vtkActor volume1 = new vtk.vtkActor();
volume1.SetMapper(mapper1);
volume1.SetProperty(volumeProperty);
volume1.SetScale(1, 1, 2);
ren1.AddActor(volume1);
ren1.SetBackground(1, 1, 1);
renWin1.AddObserver((uint)EventIds.AbortCheckEvent,
new vtkDotNetCallback(CheckAbort));
//---------------------------
// used for opengl window
//---------------------------
renWin1.SetSize(600, 600);
renWin1.Render();
iren1.Initialize();
renWin1.Render();
iren1.Start();
Best Regards
Mohammed Alam
More information about the vtkusers
mailing list