shapeup_local_projections.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2017 Amir Vaxman <avaxman@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_SHAPEUP_LOCAL_PROJECTIONS_H
  9. #define IGL_SHAPEUP_LOCAL_PROJECTIONS_H
  10. #include <igl/igl_inline.h>
  11. #include <igl/setdiff.h>
  12. #include <igl/cat.h>
  13. #include <Eigen/Core>
  14. #include <vector>
  15. namespace igl
  16. {
  17. //Every function here defines a local projection for ShapeUp, and must have the following structure to qualify:
  18. //Input:
  19. // P #P by 3 the set of points, either the initial solution, or from previous iteration.
  20. // SC #Set by 1 cardinalities of sets in S
  21. // S #Sets by max(SC) independent sets where the local projection applies. Values beyond column SC(i)-1 in row S(i,:) are "don't care"
  22. //Output:
  23. // projP #S by 3*max(SC) in format xyzxyzxyz, where the projected points correspond to each set in S in the same order.
  24. typedef std::function<bool(const Eigen::PlainObjectBase<Eigen::MatrixXd>&, const Eigen::PlainObjectBase<Eigen::VectorXi>&, const Eigen::PlainObjectBase<Eigen::MatrixXi>&, Eigen::PlainObjectBase<Eigen::MatrixXd>&)> shapeup_projection_function;
  25. //This projection does nothing but render points into projP. Mostly used for "echoing" the global step
  26. IGL_INLINE bool shapeup_identity_projection(const Eigen::PlainObjectBase<Eigen::MatrixXd>& P, const Eigen::PlainObjectBase<Eigen::VectorXi>& SC, const Eigen::PlainObjectBase<Eigen::MatrixXi>& S, Eigen::PlainObjectBase<Eigen::MatrixXd>& projP);
  27. //the projection assumes that the sets are vertices of polygons in cyclic order
  28. IGL_INLINE bool shapeup_regular_face_projection(const Eigen::PlainObjectBase<Eigen::MatrixXd>& P, const Eigen::PlainObjectBase<Eigen::VectorXi>& SC, const Eigen::PlainObjectBase<Eigen::MatrixXi>& S, Eigen::PlainObjectBase<Eigen::MatrixXd>& projP);
  29. }
  30. #ifndef IGL_STATIC_LIBRARY
  31. #include "shapeup_local_projections.cpp"
  32. #endif
  33. #endif