Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.91 KB | None | 0 0
  1.         if(label_interesting_points[index].size() == 3)
  2.         {
  3.             auto it = label_interesting_points[index].begin();
  4.             Plane p1 = planes[*it]; it++;
  5.             Plane p2 = planes[*it]; it++;
  6.             Plane p3 = planes[*it];
  7.  
  8.             cout << "p1 = " << p1._a << " " << p1._b << " " << p1._c << " " << p1._d << " " << endl;
  9.             cout << "p2 = " << p2._a << " " << p2._b << " " << p2._c << " " << p2._d << " " << endl;
  10.             cout << "p3 = " << p3._a << " " << p3._b << " " << p3._c << " " << p3._d << " " << endl;
  11.             cout << "point = " << one_point->points[0] << endl;
  12.             Eigen::Matrix3f A;
  13.             Eigen::Vector3f b;
  14.             A << p1._a, p1._b, p1._c,  p2._a, p2._b, p2._c,  p3._a, p3._b, p3._c;
  15.             b << -p1._d, -p2._d, -p3._d;
  16.             Vector3f x1 = A.colPivHouseholderQr().solve(b);
  17.             one_point->points[0] = PointXYZ(x1[0], x1[1], x1[2]);
  18.             iterate = 0;
  19.         }
  20.         else       
  21.             if(label_interesting_points[index].size() == 2)
  22.             {
  23.                 auto it = label_interesting_points[index].begin();
  24.                 Plane p1 = planes[*it]; it++;
  25.                 Plane p2 = planes[*it]; it++;
  26.  
  27.                 Eigen::Vector3f n1 = Vector3f(p1._a, p1._b, p1._c);
  28.                 Eigen::Vector3f n2 = Vector3f(p2._a, p2._b, p2._c);
  29.  
  30.                 Eigen::Vector3f n3 = n1.cross(n2);
  31.                 Eigen::Vector3f v(one_point->points[0].x, one_point->points[0].y, one_point->points[0].z);
  32.  
  33.                 double d = v.dot(n3);
  34.  
  35.             cout << "p1 = " << p1._a << " " << p1._b << " " << p1._c << " " << p1._d << " " << endl;
  36.             cout << "p2 = " << p2._a << " " << p2._b << " " << p2._c << " " << p2._d << " " << endl;
  37.             cout << "p3 = " << n3[0] << " " << n3[1] << " " << n3[2] << " " << -d << " " << endl;
  38.             cout << "2point = " << one_point->points[0] << endl;
  39.  
  40.                 Eigen::Matrix3f A;
  41.                 Eigen::Vector3f b;
  42.                 A << p1._a, p1._b, p1._c,  p2._a, p2._b, p2._c,  n3[0], n3[1], n3[2];
  43.                 b << -p1._d, -p2._d, d;
  44.                 Vector3f x1 = A.colPivHouseholderQr().solve(b);
  45.                 one_point->points[0] = PointXYZ(x1[0], x1[1], x1[2]);
  46.  
  47.                 iterate = 0;
  48.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement