per_vertex_point_to_plane_quadrics.h 2.2 KB

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