per_vertex_point_to_plane_quadrics.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef IGL_PER_VERTEX_POINT_TO_PLANE_QUADRICS_H
  2. #define IGL_PER_VERTEX_POINT_TO_PLANE_QUADRICS_H
  3. #include "igl_inline.h"
  4. #include <Eigen/Core>
  5. #include <vector>
  6. #include <tuple>
  7. namespace igl
  8. {
  9. // Compute quadrics per vertex of a "closed" triangle mesh (V,F). Rather than
  10. // follow the qslim paper, this implements the lesser-known _follow up_
  11. // "Simplifying Surfaces with Color and Texture using Quadric Error Metrics".
  12. // This allows V to be n-dimensional (where the extra coordiantes store
  13. // texture UVs, color RGBs, etc.
  14. //
  15. // Inputs:
  16. // V #V by n list of vertex positions. Assumes that vertices with
  17. // infinite coordinates are "points at infinity" being used to close up
  18. // boundary edges with faces. This allows special subspace quadrice for
  19. // boundary edges: There should never be more than one "point at
  20. // infinity" in a single triangle.
  21. // F #F by 3 list of triangle indices into V
  22. // E #E by 2 list of edge indices into V.
  23. // EMAP #F*3 list of indices into E, mapping each directed edge to unique
  24. // unique edge in E
  25. // EF #E by 2 list of edge flaps, EF(e,0)=f means e=(i-->j) is the edge of
  26. // F(f,:) opposite the vth corner, where EI(e,0)=v. Similarly EF(e,1) "
  27. // e=(j->i)
  28. // EI #E by 2 list of edge flap corners (see above).
  29. // Outputs:
  30. // quadrics #V list of quadrics, where a quadric is a tuple {A,b,c} such
  31. // that the quadratic energy of moving this vertex to position x is
  32. // given by x'Ax - 2b + c
  33. //
  34. IGL_INLINE void per_vertex_point_to_plane_quadrics(
  35. const Eigen::MatrixXd & V,
  36. const Eigen::MatrixXi & F,
  37. const Eigen::MatrixXi & EMAP,
  38. const Eigen::MatrixXi & EF,
  39. const Eigen::MatrixXi & EI,
  40. std::vector<
  41. std::tuple<Eigen::MatrixXd,Eigen::RowVectorXd,double> > & quadrics);
  42. };
  43. #ifndef IGL_STATIC_LIBRAY
  44. # include "per_vertex_point_to_plane_quadrics.cpp"
  45. #endif
  46. #endif