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

16 Ansichten (letzte 30 Tage)
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
  19 Kommentare
William Rose
William Rose am 11 Apr. 2023
I do not understand why phi becomes important if the box is rotating. If I were simulating reflections inside a rotating box, I would not use phi to compute reflections. I would continue to compute reflections with code similar to the code I provided. The difference would be that the reflection computation would be inside a loop that corresponds to time steps, and the orientation vectors of the reflecting planes would be functions of time.
Aknur am 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.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

William Rose
William Rose am 9 Mär. 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.

Weitere Antworten (0)




Community Treasure Hunt

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

Start Hunting!

Translated by