5D raytracing implementation

6 views (last 30 days)
Ryan McDermid
Ryan McDermid on 29 Apr 2016
Edited: Walter Roberson on 29 Apr 2016
Hi all...
I'm fairly new to matlab so I'm looking for some guidance on implementation of an algorithm for doing simple raytracing... here's some pseudo code of what I'm trying to accomplish....
I have a 5D array L... the first 4 dims are pairs of coordinates... the 5th is a color/intensity index... I want to intersect a ray for each pixel of the image plane(RF) with the other two polygons(s,t,u,v) to get a color index (c)...
a ray r = (s, t, u, v) has a color c(r) = c(s, t, u, v). Likewise, a pixel (x, y) in the desired image has a color c(x, y). Let K be the desired camera with a center of projection o and pixels (x, y) on its image plane. w(x, y) is an aperture weighting function , where aw is the width of the aperture.
C is the camera plane(s,t)
F is the focal plane (f,g)
r(s,t,u,v) == r(s,t,f,g)F
%RC := a polygon on C defined by {(s ± aw/2, t ± aw/2)}
%RK := projection of RC onto the desired image plane
%For each pixel (x, y) within RK
%r := the ray through o and (x, y)
%Intersect r with C and F to get (s, t) and (f, g)F
%(u, v) := MF→D s,t (f,g)F
%weight := w(s − s, t − t)
%c(x, y) := c(x, y) + weight ∗ c(s, t, u, v)
can anyone provide any insight?
/r

Answers (0)

Categories

Find more on Propagation and Channel Models in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!