'Transfer Greedy Projection Triangulation in Point Cloud Library to MATLAB

I want to know how theGreedyProjectionTriangulation gp3.h and gp3.hpp work in Point Cloud Library (which can be found in pcl/surface/include/pcl/surface/),then I can start transfer it into MATLAB(for research use).I've no one to discuss so I post here......Maybe some picture can help me.

↓ It's so hard to transfer code to geometry!!

 /** \brief Returns if a point X is visible from point R (or the origin)
    * when taking into account the segment between the points S1 and S2
    * \param X 2D coordinate of the point
    * \param S1 2D coordinate of the segment's first point
    * \param S2 2D coordinate of the segment's second point
    * \param R 2D coordinate of the reference point (defaults to 0,0)
    * \ingroup surface
    */
  inline bool 
  isVisible (const Eigen::Vector2f &X, const Eigen::Vector2f &S1, const Eigen::Vector2f &S2, 
             const Eigen::Vector2f &R = Eigen::Vector2f::Zero ())
  {
    double a0 = S1[1] - S2[1];
    double b0 = S2[0] - S1[0];
    double c0 = S1[0]*S2[1] - S2[0]*S1[1];
    double a1 = -X[1];
    double b1 = X[0];
    double c1 = 0;
    if (R != Eigen::Vector2f::Zero())
    {
      a1 += R[1];
      b1 -= R[0];
      c1 = R[0]*X[1] - X[0]*R[1];
    }
    double div = a0*b1 - b0*a1;
    double x = (b0*c1 - b1*c0) / div;
    double y = (a1*c0 - a0*c1) / div;

enter image description here

I think these two paper are the most relative:

2009 from ZC. Marton: https://pointclouds.org/documentation/tutorials/greedy_projection.html

2000 from M.Gopi: https://www.researchgate.net/publication/3998414_A_Fast_and_Efficient_Projection-Based_Approach_for_Surface_Reconstruction I'm very confuse the word "occlude" in this paper



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source