#include #include #include template IGL_INLINE void igl::sort_vectors_ccw( const Eigen::PlainObjectBase& P, const Eigen::PlainObjectBase& N, Eigen::PlainObjectBase &order, const bool do_sorted, Eigen::PlainObjectBase &sorted, const bool do_inv_order, Eigen::PlainObjectBase &inv_order) { int half_degree = P.cols()/3; //local frame Eigen::Matrix e1 = P.head(3).normalized(); Eigen::Matrix e3 = N.normalized(); Eigen::Matrix e2 = e3.cross(e1); Eigen::Matrix F; F< angles(half_degree,1); for (int i=0; i Pl = F.colPivHouseholderQr().solve(P.segment(i*3,3).transpose()).transpose(); assert(fabs(Pl(2))/Pl.cwiseAbs().maxCoeff() <1e-5); angles[i] = atan2(Pl(1),Pl(0)); } igl::sort( angles, 1, true, angles, order); //make sure that the first element is always at the top while (order[0] != 0) { //do a circshift int temp = order[0]; for (int i =0; i< half_degree-1; ++i) order[i] = order[i+1]; order(half_degree-1) = temp; } if (do_sorted) { sorted.resize(1,half_degree*3); for (int i=0; i, Eigen::Matrix >(Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase >&, bool, Eigen::PlainObjectBase >&, bool, Eigen::PlainObjectBase >&); #endif