title: Remove points outside defined 3D box inside PCL visualizer
body: <p>In a given point cloud, I want to remove all the points which are less than <code>min</code> and greater than <code>max</code> for all <code>x</code>, <code>y</code> and <code>z</code> direction. Below is the sample code:</p>
  
  <pre><code>#include &lt;pcl/io/io.h&gt;
  #include &lt;pcl/io/pcd_io.h&gt;
  #include &lt;pcl/filters/passthrough.h&gt;
  #include &lt;pcl/visualization/pcl_visualizer.h&gt;
  
  // Define min and max for X, Y and Z
  float minX = -0.1, minY = -0.5, minZ = -2.5;
  float maxX = +0.1, maxY = +0.5, maxZ = +2.5;
  
  int main (int argc, char** argv)
  {
      pcl::visualization::PCLVisualizer viewer("Cloud Viewer");
  
      pcl::PointCloud&lt;pcl::PointXYZRGBA&gt;::Ptr body (new pcl::PointCloud&lt;pcl::PointXYZRGBA&gt;);
      pcl::io::loadPCDFile ("body.pcd", *body);
  
      pcl::PointCloud&lt;pcl::PointXYZRGBA&gt;::Ptr bodyFiltered (new pcl::PointCloud&lt;pcl::PointXYZRGBA&gt;);
  
      pcl::PassThrough&lt;pcl::PointXYZRGBA&gt; filter;
      filter.setInputCloud (body);
      filter.setFilterFieldName ("x");
      filter.setFilterLimits (minX, maxX);
      filter.setFilterFieldName ("y");
      filter.setFilterLimits (minY, maxY);
      filter.setFilterFieldName ("z");
      filter.setFilterLimits (minZ, maxZ);
      filter.filter (*bodyFiltered);
  
      viewer.addPointCloud (bodyFiltered,"body");
      viewer.spin();
      return 0;
  }
  </code></pre>
  
  <p>It seems that only last filter is being applied. Any solution, please?</p>