bone_visible.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 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_BONE_VISIBLE_H
  9. #define IGL_BONE_VISIBLE_H
  10. #include <igl/igl_inline.h>
  11. #include <Eigen/Core>
  12. //
  13. // BONE_VISIBLE test whether vertices of mesh are "visible" to a given bone,
  14. // where "visible" is defined as in [Baran & Popovic 07]. Instead of checking
  15. // whether each point can see *any* of the bone, we just check if each point
  16. // can see its own projection onto the bone segment. In other words, we project
  17. // each vertex v onto the bone, projv. Then we check if there are any
  18. // intersections between the line segment (projv-->v) and the mesh.
  19. //
  20. // [flag] = bone_visible(V,F,s,d);
  21. //
  22. // Input:
  23. // s row vector of position of start end point of bone
  24. // d row vector of position of dest end point of bone
  25. // V #V by 3 list of vertex positions
  26. // F #F by 3 list of triangle indices
  27. // Output:
  28. // flag #V by 1 list of bools (true) visible, (false) obstructed
  29. //
  30. // Note: This checks for hits along the segment which are facing in *any*
  31. // direction from the ray.
  32. //
  33. namespace igl
  34. {
  35. template <
  36. typename DerivedV,
  37. typename DerivedF,
  38. typename DerivedSD,
  39. typename Derivedflag>
  40. IGL_INLINE void bone_visible(
  41. const Eigen::PlainObjectBase<DerivedV> & V,
  42. const Eigen::PlainObjectBase<DerivedF> & F,
  43. const Eigen::PlainObjectBase<DerivedSD> & s,
  44. const Eigen::PlainObjectBase<DerivedSD> & d,
  45. Eigen::PlainObjectBase<Derivedflag> & flag);
  46. }
  47. #ifdef IGL_HEADER_ONLY
  48. # include "bone_visible.cpp"
  49. #endif
  50. #endif