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

24 ビュー (過去 30 日間)
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 件のコメント
William Rose
William Rose 2023 年 4 月 11 日
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
Aknur 2023 年 4 月 11 日
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
William Rose 2023 年 3 月 9 日
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.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMotion Modeling and Coordinate Systems についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by