title: Visualise normals of PointNormal point cloud in PCL
body: <p>I am trying to visualize normals that are contained in a <code>pcl::PointNormal</code> point cloud. I try to do this with following code:</p>
  
  <pre><code>std::shared_ptr&lt;pcl::visualization::PCLVisualizer&gt; viewer;
  std::mutex viewerMutex;
  
  void viewerThreadFunction() {
      while(true) {
          if(viewer-&gt;wasStopped()) break;
          viewerMutex.lock();
          viewer-&gt;spinOnce();
          viewerMutex.unlock();
      }
  }
  
  int main() {
      viewer = std::shared_ptr&lt;pcl::visualization::PCLVisualizer&gt;(
                      new pcl::visualization::PCLVisualizer("Viewer"));
      viewer-&gt;setBackgroundColor(0, 0, 0);
  
      pcl::PointCloud&lt;pcl::PointNormal&gt;::Ptr cloud(new pcl::PointCloud&lt;pcl::PointNormal&gt;);
  
      viewer-&gt;addPointCloudNormals&lt;pcl::PointNormal, pcl::PointNormal&gt; (cloud, cloud, 25, 0.15, "normals"); // It throws an exception here:
  
      std::thread viewerThread{viewerThreadFunction};
  
      while(true) {
          // populate the point cloud
          viewerMutex.lock();
          viewer-&gt;removePointCloud("normals");
          viewer-&gt;addPointCloudNormals&lt;pcl::PointNormal, pcl::PointNormal&gt; (cloud, cloud, 25, 0.15, "normals");
          viewerMutex.unlock();
      }
  }
  </code></pre>
  
  <p>I get an exception:</p>
  
  <pre><code>terminate called after throwing an instance of 'std::bad_array_new_length'
      what(): std::bad_array_new_length
  Aborted (core dumped)
  </code></pre>
  
  <p>I tried to rewrite the program so, that <code>viewer-&gt;addPointCloudNormals</code> is called only on a populated point cloud, but it did not help. </p>