# How I can define/ calculate reflection of the ray correctly? As my reflection makes mistake in direction

65 views (last 30 days)
Aknur on 9 Mar 2023
Commented: Aknur on 11 Apr 2023
Hello, everyone. Kinsly ask about advice or suggestion about how to find reflection of incidence ray and plot it
How I can make reflected ray in 3d indoor. I wrote function step by step but when it reflects it does not work properly. Maybe you can advice me function or documentation/source. I did everything with geometry. And tried then to solve using Rr = Ri - 2 N (Ri . N)
and my R become like 0.7 1.5 -157 which is not coreect.
The main problem that my ray does not reflect from the surface. I found intersection. Maybe something wrong with my directional vector and angles theta
Thank you in advance
Aknur on 11 Apr 2023
Dear @William Rose thank you so much for your question
Because I set the direction vector using two angles theta and phi and reflected angles of theta and phi will set a new direction vector for the next ray. I hope I was able to explain. However, there is also an option to do without any changes in angle phi, but I have to see how it will go with changing angle phi. Because when the plane changes then the angle phi also has to be changed as the plane is different from the incident plane.

William Rose on 9 Mar 2023
I meant the comment above to be an answer; please consider it to be one. t is a scalar, t>=0 so that the reflected ray is only on one side of the plane.

### Categories

Find more on Triangulation Representation in Help Center and File Exchange

R2021b

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by