Question: Base on the recursive algorithm in unit 1 0 section 2 objective 3 , implement a recursive routine in the program of unit 1 1

Base on the recursive algorithm in unit 10 section 2 objective 3, implement a recursive routine in the program of unit 11 section 2 objective 1 to produce a similar reflective effect.
The minimum requirement is to rewrite the method render() of the program to implement the recursive ray tracing algorithm. The implemented recursive method should cast a ray from the ray source to the scene. The ray may either hit the wall (a non-reflective surface here) or hit the floor (a reflective surface here). If it hits the wall, the method can terminate the recursion and return the local color of the wall. If the ray hits the floor, the method should (recursively) invoke itself with the reflection ray, and calculate and return the mixed color as demonstrated in the original render() routine.
You may hard-code the inclusion test or you may implement your own method to support the inclusion. Also you may need to hard-code the normal vector of the wall and the floor.
Feel free to change the program to suit your needs.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!