[vtk-developers] vtkSphereSource vtkImplicitBoolean
Шишкин А.А.
a_shishkin at diatech.ru
Thu Apr 14 09:50:26 EDT 2016
Hello! Please let you help me solve the problem.
We need to combine two or more intersected shell surface type objects,
implemented as vtkPolyDataAlgorithm objects, in a single bound surface with
initial points and cells of given objects but inner points (and cells)
excluded.
To test the possible workaround I have created two sample successors of
vtkSphereSource class [vtkSphereSourceNew ] with reimplemented RequestData
member function. The last generates its own points and cells.
These two objects of vtkSphereSourceNew type are intersected in universe
space.
I try to use vtkImplicitBoolean function to combine in one united outer
surface with inner points and cells excluded.
Please inform me whether vtkImplicitDataSet class was used properly?
The following test code will result in exception:
vtkSmartPointer<vtkSphereSourceNew> sphere1 =
vtkSmartPointer<vtkSphereSourceNew>::New();
sphere1->SetCenter(.9,0,0);
vtkImplicitDataSet* Imsphere1 = vtkImplicitDataSet::New();
Imsphere2->SetDataSet(sphere1->GetOutput());
vtkSmartPointer<vtkSphereSourceNew> sphere2
=vtkSmartPointer<vtkSphereSourceNew>::New();
sphere2->SetCenter(-.9,0,0);
vtkImplicitDataSet* Imsphere2 = vtkImplicitDataSet::New();
Imsphere2->SetDataSet(sphere2->GetOutput());
vtkSmartPointer<vtkImplicitBoolean> implicitBoolean
=vtkSmartPointer<vtkImplicitBoolean>::New();
implicitBoolean->AddFunction(Imsphere1);
implicitBoolean->AddFunction(Imsphere2);
implicitBoolean->SetOperationTypeToUnion();
vtkSmartPointer<vtkSampleFunction> sample =
vtkSmartPointer<vtkSampleFunction>::New();
sample->SetSampleDimensions(10,10,10);
sample->SetImplicitFunction(implicitBoolean);
double value = 3.0;
double xmin = -value, xmax = value,
ymin = -value, ymax = value,
zmin = -value, zmax = value;
sample->SetModelBounds(xmin, xmax, ymin, ymax, zmin, zmax);
vtkSmartPointer<vtkContourFilter> contours
=vtkSmartPointer<vtkContourFilter>::New();
contours->SetInputConnection(sample->GetOutputPort());
contours->GenerateValues(1, 1, 1);
vtkSmartPointer<vtkDataSetMapper> mapper =
vtkSmartPointer<vtkDataSetMapper>::New();
mapper->SetInputConnection(contours->GetOutputPort());
mapper->Update();
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
actor->SetMapper(mapper);
Thank you for help!
Faithfully yours, Andrey.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20160414/40d1a5e5/attachment-0001.html>
More information about the vtk-developers
mailing list