51 #include <boost/function.hpp>
72 isVisible (
const Eigen::Vector2f &X,
const Eigen::Vector2f &S1,
const Eigen::Vector2f &S2,
73 const Eigen::Vector2f &R = Eigen::Vector2f::Zero ())
75 double a0 = S1[1] - S2[1];
76 double b0 = S2[0] - S1[0];
77 double c0 = S1[0]*S2[1] - S2[0]*S1[1];
81 if (R != Eigen::Vector2f::Zero())
85 c1 = R[0]*X[1] - X[0]*R[1];
87 double div = a0*b1 - b0*a1;
88 double x = (b0*c1 - b1*c0) / div;
89 double y = (a1*c0 - a0*c1) / div;
91 bool intersection_outside_XR;
92 if (R == Eigen::Vector2f::Zero())
95 intersection_outside_XR = (x <= 0) || (x >= X[0]);
97 intersection_outside_XR = (x >= 0) || (x <= X[0]);
99 intersection_outside_XR = (y <= 0) || (y >= X[1]);
101 intersection_outside_XR = (y >= 0) || (y <= X[1]);
103 intersection_outside_XR =
true;
108 intersection_outside_XR = (x <= R[0]) || (x >= X[0]);
109 else if (X[0] < R[0])
110 intersection_outside_XR = (x >= R[0]) || (x <= X[0]);
111 else if (X[1] > R[1])
112 intersection_outside_XR = (y <= R[1]) || (y >= X[1]);
113 else if (X[1] < R[1])
114 intersection_outside_XR = (y >= R[1]) || (y <= X[1]);
116 intersection_outside_XR =
true;
118 if (intersection_outside_XR)
123 return (x <= S2[0]) || (x >= S1[0]);
124 else if (S1[0] < S2[0])
125 return (x >= S2[0]) || (x <= S1[0]);
126 else if (S1[1] > S2[1])
127 return (y <= S2[1]) || (y >= S1[1]);
128 else if (S1[1] < S2[1])
129 return (y >= S2[1]) || (y <= S1[1]);
141 template <
typename Po
intInT>
172 minimum_angle_ (M_PI/18),
173 maximum_angle_ (2*M_PI/3),
176 consistent_ordering_ (false),
187 is_current_free_ (false),
189 prev_is_ffn_ (false),
190 prev_is_sfn_ (false),
191 next_is_ffn_ (false),
192 next_is_sfn_ (false),
193 changed_1st_fn_ (false),
194 changed_2nd_fn_ (false),
196 already_connected_ (false),
297 inline std::vector<int>
303 inline std::vector<int>
308 inline std::vector<int>
312 inline std::vector<int>
320 double search_radius_;
326 double minimum_angle_;
329 double maximum_angle_;
338 bool consistent_ordering_;
353 doubleEdge () : index (0), first (), second () {}
355 Eigen::Vector2f first;
356 Eigen::Vector2f second;
364 std::vector<Eigen::Vector3f> coords_;
367 std::vector<nnAngle> angles_;
371 std::vector<int> state_;
373 std::vector<int> source_;
375 std::vector<int> ffn_;
377 std::vector<int> sfn_;
379 std::vector<int> part_;
381 std::vector<int> fringe_queue_;
384 bool is_current_free_;
396 bool changed_1st_fn_;
398 bool changed_2nd_fn_;
405 bool already_connected_;
408 Eigen::Vector3f proj_qp_;
414 Eigen::Vector2f uvn_ffn_;
416 Eigen::Vector2f uvn_sfn_;
418 Eigen::Vector2f uvn_next_ffn_;
420 Eigen::Vector2f uvn_next_sfn_;
423 Eigen::Vector3f tmp_;
435 performReconstruction (std::vector<pcl::Vertices> &polygons);
441 reconstructPolygons (std::vector<pcl::Vertices> &polygons);
445 getClassName ()
const {
return (
"GreedyProjectionTriangulation"); }
458 connectPoint (std::vector<pcl::Vertices> &polygons,
459 const int prev_index,
460 const int next_index,
461 const int next_next_index,
462 const Eigen::Vector2f &uvn_current,
463 const Eigen::Vector2f &uvn_prev,
464 const Eigen::Vector2f &uvn_next);
471 closeTriangle (std::vector<pcl::Vertices> &polygons);
476 std::vector<std::vector<size_t> >
486 addTriangle (
int a,
int b,
int c, std::vector<pcl::Vertices> &polygons)
489 if (consistent_ordering_)
491 const PointInT p = input_->at (indices_->at (a));
492 const Eigen::Vector3f pv = p.getVector3fMap ();
493 if (p.getNormalVector3fMap ().dot (
494 (pv - input_->at (indices_->at (b)).getVector3fMap ()).cross (
495 pv - input_->at (indices_->at (c)).getVector3fMap ()) ) > 0)
514 polygons.push_back (triangle_);
522 addFringePoint (
int v,
int s)
526 fringe_queue_.push_back(v);
535 nnAngleSortAsc (
const nnAngle& a1,
const nnAngle& a2)
537 if (a1.visible == a2.visible)
538 return (a1.angle < a2.angle);
546 #endif //#ifndef PCL_GP3_H_