bone_visible.h 1.4 KB

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