필터 지우기
필터 지우기

Vector against a mirror

조회 수: 6 (최근 30일)
John Plant
John Plant 2012년 5월 15일
Hi. I'm doing a simulation of a light ray that hits a convergent mirror and comes back in a different direction. However I'm having trouble finding the direction... I have the normal direction of the mirror and the inciding ray. (used the quiver function)
Anyone has any idea how I can find the reflected ray?

채택된 답변

Geoff
Geoff 2012년 5월 15일
From memory... I could be wrong here.
Make sure your incoming ray R and surface normal N (which points out) are both unit vectors.
Project the surface normal onto the incoming ray with dot product. This tells you how much vertical component there is in your ray. By definition this will be negative because your two vectors oppose. You can test this: positive = no reflection.
Now think... You need to add that vertical component to your ray TWICE (once cancels out the ray's vertical travel, and twice reverses the direction). Don't forget the product will be negative so you must subtract it!!
t = dot(N,R);
if t >= 0
S = R;
else
S = R - 2 * N * t;
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Geometric Geodesy에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by