コード例 #1
0
ファイル: box_clipper3D.hpp プロジェクト: SunBlack/pcl
template<typename PointT> bool
pcl::BoxClipper3D<PointT>::clipPoint3D (const PointT& point) const
{
  Eigen::Vector4f point_coordinates (transformation_.matrix ()
    * point.getVector4fMap ());
  return (point_coordinates.array ().abs () <= 1).all ();
}
コード例 #2
0
ファイル: pcl_visualizer.hpp プロジェクト: MorS25/megatree
    template <typename PointT> bool
    PCLVisualizer::addSphere (const PointT &center, double radius, double r, double g, double b, const std::string &id, int viewport)
    {
      // Check to see if this ID entry already exists (has it been already added to the visualizer?)
      ShapeActorMap::iterator am_it = shape_actor_map_->find (id);
      if (am_it != shape_actor_map_->end ())
      {
        PCL_WARN ("[addSphere] A shape with id <%s> already exists! Please choose a different id and retry.\n", id.c_str ());
        return (false);
      }

      vtkSmartPointer<vtkDataSet> data = createSphere (center.getVector4fMap (), radius);

      // Create an Actor
      vtkSmartPointer<vtkLODActor> actor;
      createActorFromVTKDataSet (data, actor);
      actor->GetProperty ()->SetRepresentationToWireframe ();
  actor->GetProperty ()->SetInterpolationToGouraud ();
  actor->GetMapper ()->ScalarVisibilityOff ();
      actor->GetProperty ()->SetColor (r, g, b);
  addActorToRenderer (actor, viewport);

  // Save the pointer/ID pair to the global actor map
  (*shape_actor_map_)[id] = actor;
      return (true);
    }
コード例 #3
0
ファイル: box_clipper3D.hpp プロジェクト: SunBlack/pcl
template<typename PointT> void
pcl::BoxClipper3D<PointT>::transformPoint (const PointT& pointIn, PointT& pointOut) const
{
  const Eigen::Vector4f& point = pointIn.getVector4fMap ();
  pointOut.getVector4fMap () = transformation_ * point;

  // homogeneous value might not be 1
  if (point [3] != 1)
  {
    // homogeneous component might be uninitialized -> invalid
    if (point [3] != 0)
    {
      pointOut.x += (1 - point [3]) * transformation_.data () [ 9];
      pointOut.y += (1 - point [3]) * transformation_.data () [10];
      pointOut.z += (1 - point [3]) * transformation_.data () [11];
    }
    else
    {
      pointOut.x += transformation_.data () [ 9];
      pointOut.y += transformation_.data () [10];
      pointOut.z += transformation_.data () [11];
    }
  }
}