Closed Mateasek closed 2 years ago
Sounds like this needs UV coordinates to be added to the mesh. Not a small task. Adding it to the Intersection object though isn't really generally appropriate as its unique to a single primitive.
I agree though, this would be useful if such a mechanism was available. Doing it in a way that isn't hacky might take some time.
Was thinking more about this, I guess the pathway for adding this would be:
This would be the most general pathway and allow other usage as well. But there is a lot of work in adding it all.
I'd use a Point2D, not a tuple.
@CnlPepper and I were talking about this in the office. We think the Intersection object could be modified to take a material object chosen by the primitive. This could include references to the missing coordinate information.
Fixed in release 0.8.0. Meshes return a mesh specific intersection object with triangle ID and barycentric coordinates accessible. UV coords can be added later with wider texturing support.
Recently I needed to get the id of the face which was hit by a ray. Is there now any way of getting it? For now I've solved it by adding a class variable to the 'Intersect' class as an optional parameter in the init() function and passed the id in the 'MeshData.calc_intersection' method.
This is probably not the best way how to do it, but such functionality could nicely extend usage of Raysect. At least for me.