Ray reflection 3D MuPAD

3 views (last 30 days)
Gabriela Cristina
Gabriela Cristina on 22 Feb 2013
Hello.
I am trying to determine the direction of a reflected ray like in the "sunlight in a tea cup" example. The problem is that I am working with 3D. My program is
reset():
DIGITS := 2:
B:=(x,y) -> 1-1/(x^2 + y^2):
a := stats::uniformRandom(-1, 1):
b := stats::uniformRandom(-1, 1):
plot(plot::Function3d(B(x,y), x=-1..1,y=-1..1,Filled = FALSE),
plot::Line3d([b(),a(), 1], [x,y,B(x,y)], VisibleAfter = 1*x ) $ x in [-1.05 + i/5 $ i = 1..10] $ y in [-1.05 + i/5 $ i = 1..10],
// The reflected rays leaving to the right:
//plot::Line2d([x,y,B(x,y)]],
// [1, f(x) + (1-x)*(f'(x) - 1/f'(x))/2],
// Color = RGB::Orange, VisibleAfter = 5*x
// ) $ x in [-1 + i/20 $ i = 1..19],
ViewingBox = [-1..1, -1..1, -4..1]):
The commented lines are from the "sunlight in a tea cup" example.
How can I transform f(x) + (1-x)*(f'(x) - 1/f'(x))/2 to 3D?

Answers (0)

Community Treasure Hunt

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

Start Hunting!