2d reflection ray
in
Programming Questions
•
1 year ago
Hi guys,
In the picture below I'm illustrating the goal I'm trying to reach.
Conceptually, this is a laser (vector) that reflects on a shape. I'd like to detect which of those gray surfaces it hits after the reflection.

Actually, this one would be simple to do inside an animation context. I'd simply use box2d and that's it. But this time, I'm looking for an instant result as a light ray would do.
I looked for toxiclibs' shpere reflection, but I didn't find a way to take a prism instead of a sphere. And also, I don't really need this to be 3d.
I looked for Processing's reflexion sketches too, but it doesnt seems to be exactly what i'm searching.
Do you have an idea how to make this?
Thanks a lot :)
www.ignivome.com
In the picture below I'm illustrating the goal I'm trying to reach.
Conceptually, this is a laser (vector) that reflects on a shape. I'd like to detect which of those gray surfaces it hits after the reflection.
Actually, this one would be simple to do inside an animation context. I'd simply use box2d and that's it. But this time, I'm looking for an instant result as a light ray would do.
I looked for toxiclibs' shpere reflection, but I didn't find a way to take a prism instead of a sphere. And also, I don't really need this to be 3d.
I looked for Processing's reflexion sketches too, but it doesnt seems to be exactly what i'm searching.
Do you have an idea how to make this?
Thanks a lot :)
www.ignivome.com
1

), but hopefully it will give you some insight and serve as a starting point for further explorations. Perhaps I will try to do it with Toxiclibs next, because I think it will actually be shorter and easier using all the math magic in there.