27 #include <xmmintrin.h>
28 #include <smmintrin.h>
33 #include "grahams_scan.h"
34 #include <eigen3/Eigen/Dense>
35 #include <eigen3/Eigen/Eigenvalues>
36 #include <eigen3/Eigen/Geometry>
38 #ifndef PLANE_POLYGON_H
39 #define PLANE_POLYGON_H
42 using namespace Eigen;
62 Matrix3d
m, eigenVectors;
66 SelfAdjointEigenSolver<Matrix3d>
solver;
89 double sum_xx, sum_yy, sum_zz, sum_xy, sum_xz, sum_yz;
105 bool constructConvexPoly(vector<vector3f>& points);
107 bool computePlaneParameters(vector<vector3f>& points);
115 PlanePolygon(vector<vector3f> points, vector<vector2i> _pixelLocs);
126 bool liesAlongside(
const vector3f& p)
const;
130 void merge(vector< PlanePolygon >& polygons);
132 void transform(
vector3f translation, Quaternionf rotation);
139 #endif //PLANE_POLYGON_H
Subroutines to spice up stdout.
bool validPolygon
Indicates whether a valid convex plane polygon fit was copmuted or not.
float width
Rectangular dimensions of the polygon.
vector2f min2D
Rectangular extents of the polygon in 2D.
vector< double > offsets2D
Offsets to the edges such that for an interior point p, normals2D[i].dot(p)+offsets2D[i]> 0 for all i...
SelfAdjointEigenSolver< Matrix3d > solver
Solver to solve for optimal plane parameters.
Helpers for integrating Eigen Quaternions with GVector classes.
Matrix3d m
Matrices for computing optimal plane parameters.
Vector3d eigenValues
Eigenvectors of the plane scatter matrix.
vector3f p0
Point on the plane corresponding to the centroid of the sampled points.
double offset
Perpendicular offset of the plane from the origin.
vector< double > edgeLengths
Length of the edge (vertices2D[i], vertices2D[i+1])
vector2f projectOnto(const vector3f &p) const
Project 3D point onto the plane polygon and return corresponding 2D coordinates.
double conditionNumber
Ratio of the eigenvalues corresponding to the planar basis vectors.
vector< vector3f > vertices
Vertices of the polygon.
vector< vector2f > vertices2D
Vertices projected onto the 2D basis vectors.
vector3f b1
Basis vectors on the plane. b1 corresponds to the major axis and b2 to the minor axis.
GrahamsScan grahamsScan
Graham Scan class used to generate convex hull of the polygon.
vector< vector2i > pixelLocs
Pixel locations of the points sampled from the depth image used to construct the polygon.
vector< vector2d > normals2D
Normals to the edges. normals2D[i] is normal to the edge (vertices2D[i], vertices2D[i+1]) ...
double numPoints
Number of points used to build the polygon.
vector< vector2d > edgeDir2D
Unit vectors parallel to the edges. edgeDir2D[i] is parallel to the edge (vertices2D[i], vertices2D[i+1])
double sum_xx
Coefficients of the moments of the points.
vector3f normal
Normal to the plane.