libacc icon indicating copy to clipboard operation
libacc copied to clipboard

Barycentric Coordinates of the closest point

Open allo- opened this issue 7 years ago • 1 comments

I will need the barycentric coordinates of the hit point in closest_point. I think of creating some Hit like struct with triangle id, 3D point, barycentric point and possibly distance as well or maybe a pair<Vec3fType, Hit>. What type would you prefer and do I need to care about the API in the develop branch or is it not used, yet?

allo- avatar Aug 07 '17 15:08 allo-

I implemented it with a new struct in primitive.h and in bvhtree.h.

I will soon push patches based on develop in my repo:

  • Bugfix for iterators (in MSVC): https://github.com/allo-/libacc/commit/eed352b8e673c3a6527f910fcde9045074762da9
  • libeigen #ifdefs
  • Hits with struct containing intersection point, index, distance and barycentric coordinates
  • (TODO): Templates for scalar type.

I do not know how easy it will be to cherry-pick / branch on the different things. For the first three I have a patched code which I will split into different commits, but the later ones probably won't apply without change, if you do not have the first ones.

Further I may look into returning the k nearest triangles. I am not sure how easy it will be, but I think about just merging the leafes in the higher nodes until k triangles are found.

allo- avatar Aug 09 '17 20:08 allo-