# vtkPoissonDiskSampler with STLs

**URL:** https://discourse.vtk.org/t/vtkpoissondisksampler-with-stls/7045
**Category:** Support
**Created:** [November 2, 2021, 1:39pm UTC](https://discourse.vtk.org/t/vtkpoissondisksampler-with-stls/7045 "2021-11-02T13:39:14Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![mrwsl](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/m/5f9b8f/32.png) [@mrwsl](https://discourse.vtk.org/u/mrwsl)
#### Post date: [November 2, 2021, 1:39pm UTC](https://discourse.vtk.org/t/vtkpoissondisksampler-with-stls/7045/1 "2021-11-02T13:39:14Z")

</div>

I adjusted the [PolyDataPointSampler](https://kitware.github.io/vtk-examples/site/Cxx/PolyData/PolyDataPointSampler/) to use the PoissonDiskSampler (lines 45-48):

```cpp
  vtkNew<vtkPoissonDiskSampler> sample;
  sample->SetInputData(polyData);
  sample->SetRadius(1);
  sample->Update();
  std::cout << "# of points after sampling: "
            << sample->GetOutput()->GetNumberOfPoints() << std::endl;

```

While this example works fine with the default sphere, it doesn’t when I provide an STL[1]. I get a segmentation fault and wonder what I’m doing wrong:

```auto
(gdb) run ../Cube\ with\ Cube-Body.stl
Starting program: [...]/build/PolyDataPointSampler ../Cube\ with\ Cube-Body.stl
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Range: 20, 20, 20
# of original points: 16

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7f24921 in vtkPoissonDiskSampler::RequestData(vtkInformation*, vtkInformationVector**, vtkInformatio
(gdb) bt
(gdb) bt
#0 0x00007ffff7f24921 in vtkPoissonDiskSampler::RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) ()
   from /usr/local/lib/libvtkFiltersPoints-9.1.so.1
#1 0x00007ffff65c98e0 in vtkExecutive::CallAlgorithm(vtkInformation*, int, vtkInformationVector**, vtkInformationVector*) ()
   from /usr/local/lib/libvtkCommonExecutionModel-9.1.so.1
#2 0x00007ffff65c3ac9 in vtkDemandDrivenPipeline::ExecuteData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) ()
   from /usr/local/lib/libvtkCommonExecutionModel-9.1.so.1
#3 0x00007ffff65c0701 in vtkCompositeDataPipeline::ExecuteData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) ()
   from /usr/local/lib/libvtkCommonExecutionModel-9.1.so.1
#4 0x00007ffff65c678f in vtkDemandDrivenPipeline::ProcessRequest(vtkInformation*, vtkInformationVector**, vtkInformationVector*) ()
   from /usr/local/lib/libvtkCommonExecutionModel-9.1.so.1
#5 0x00007ffff6608b81 in vtkStreamingDemandDrivenPipeline::ProcessRequest(vtkInformation*, vtkInformationVector**, vtkInformationVector*) () from /usr/local/lib/libvtkCommonExecutionModel-9.1.so.1
#6 0x00007ffff6609f17 in vtkStreamingDemandDrivenPipeline::Update(int, vtkInformationVector*) ()
   from /usr/local/lib/libvtkCommonExecutionModel-9.1.so.1
#7 0x0000555555559824 in main ()

```

[1] mentioned [STL](https://tubcloud.tu-berlin.de/s/gTp34gfnfcnTZXY)

---

<div class="post-metadata">

### Author: ![Yohann\_Bearzi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/yohann_bearzi/32/671_2.png) [@Yohann\_Bearzi](https://discourse.vtk.org/u/Yohann_Bearzi)
#### Post date: [November 2, 2021, 2:23pm UTC](https://discourse.vtk.org/t/vtkpoissondisksampler-with-stls/7045/2 "2021-11-02T14:23:04Z")

</div>

Does it also crash if you run it in a non-threaded environment?

---

<div class="post-metadata">

### Author: ![mrwsl](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/m/5f9b8f/32.png) [@mrwsl](https://discourse.vtk.org/u/mrwsl)
#### Post date: [November 2, 2021, 2:36pm UTC](https://discourse.vtk.org/t/vtkpoissondisksampler-with-stls/7045/3 "2021-11-02T14:36:55Z")

</div>

If I run it in with `numactl --physcpubind=+1` it still throws the segfault.
