bone_visible.h 1.4 KB

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