setxor.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2016 Alec Jacobson <[email protected]>
  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_SETXOR_H
  9. #define IGL_SETXOR_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. namespace igl
  13. {
  14. /// Set xor of elements of matrices
  15. ///
  16. /// @param[in] A m-long vector of indices
  17. /// @param[in] B n-long vector of indices
  18. /// @param[out] C (k<=m)-long vector of unique elements appearing in A but not in B or
  19. /// B but not in A
  20. /// @param[out] IA (<k<=m)-long list of indices into A so that C = sort([A(IA);B(IB)])
  21. /// @param[out] IB (<k<=m)-long list of indices into B so that C = sort([A(IA);B(IB)])
  22. ///
  23. template <
  24. typename DerivedA,
  25. typename DerivedB,
  26. typename DerivedC,
  27. typename DerivedIA,
  28. typename DerivedIB>
  29. IGL_INLINE void setxor(
  30. const Eigen::MatrixBase<DerivedA> & A,
  31. const Eigen::MatrixBase<DerivedB> & B,
  32. Eigen::PlainObjectBase<DerivedC> & C,
  33. Eigen::PlainObjectBase<DerivedIA> & IA,
  34. Eigen::PlainObjectBase<DerivedIB> & IB);
  35. }
  36. #ifndef IGL_STATIC_LIBRARY
  37. # include "setxor.cpp"
  38. #endif
  39. #endif