# How to sample implicit function in different bounds

**URL:** https://discourse.vtk.org/t/how-to-sample-implicit-function-in-different-bounds/808
**Category:** Support
**Created:** [April 22, 2019, 6:42am UTC](https://discourse.vtk.org/t/how-to-sample-implicit-function-in-different-bounds/808 "2019-04-22T06:42:39Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Frank](https://discourse.vtk.org/user_avatar/discourse.vtk.org/frank/32/43_2.png) [@Frank](https://discourse.vtk.org/u/Frank)
#### Post date: [April 22, 2019, 6:42am UTC](https://discourse.vtk.org/t/how-to-sample-implicit-function-in-different-bounds/808/1 "2019-04-22T06:42:39Z")

</div>

I get a `vtkImplicitFunction` object and want to sample it over a structured point set. I know the approximate shape of the implicit. So I want to sample `vtkImplicitFunction` in different bounds(they could be overlap) and finally put them together

```auto
// this is the implicit function
vtkSmartPointer<vtkImplicitFunction> implicit = xxx;
// sample it in different bounds(overlap)
for(int i = 0; i < n; i++){
    auto sample = vtkSmartPointer<vtkSampleFunction>::New();
    sample->SetImplicitFunction(implicit);
    // bound_i 
    sample->SetModelBounds(bound_i);
    sample->update();
}
// put each sample in a image data, how ?
vtkSmartPointer<vtkImageData> data = sum(samples)

auto surface = vtkSmartPointer<vtkContourFilter>::New();
surface->SetInputConnection(data);
surface->ComputeNormalsOff();
surface->SetValue(0, 0.0);
surface->Update();

```

How can I do that?
