Dear all,

I have an algorithm for 2D ray tracing but I don’t know how to convert them into codes:-

color Ray(point S, vector D, int depth)

{

point I; /* intersection point */
vector R; /* reflected direction

*/*

vector T; /transmitted direction

vector T; /

*/*

color Lc; /local illumination

color Lc; /

*/*

color Rc; /reflected color

color Rc; /

*/*

color Tc; /transmitted color

color Tc; /

*/*

color Ac; /accumulated color */

color Ac; /

if (depth > MAXDEPTH) {

Ac := BLACK;

}

else

{ I := nerestIntersectionPoint (S,D);

if (noIntersection(I)) {

Ac := BLACK;

} else {

Lc := LocalIllumination (I);

R := ReflectedDirection (I,D);

Rc := Ray (I,R,depth+1);

T := TransmittedDirection (I,D);

Tc := Ray (I,T, depth+1);

Ac := Combine (Lc, Rc, Tc);

}

} return Ac; }