raysect / source

The main source repository for the Raysect project.
http://www.raysect.org
BSD 3-Clause "New" or "Revised" License
88 stars 23 forks source link

Get obect from a raysect.optical.loggingray.LoggingRay log #250

Closed Mateasek closed 5 years ago

Mateasek commented 5 years ago

Is there any way how to get object for the hits returned by LoggingRay? If not, it could be a nice enhancement for the LoggingRay to return both the coordinates of the interesction of a ray with an object and the object itself.

mattngc commented 5 years ago

I think this makes sense to me. I can see why it would be better to return a tuple of the intersection point and the object intersected. In an example case I did it was difficult to tell which point in the list corresponded to which object/surface in the scene.

Another option would be to store the intersection object itself. But I can imagine there might be other reasons for not wanting to do this.

@CnlPepper, can you have a think about this and suggest a solution for me to implement?

CnlPepper commented 5 years ago

We should just switch it to store the intersection object itself, it would use a bit more memory (~10x) but would be more flexible.

mattngc commented 5 years ago

This has now been fixed in the above commits. You can start using this functionality in the latest development branch or wait till merge with master.