Sequential Raytracer Assignment
Contents
Motivation
We learn the basics of using an instance of RayTraceContext to raytrace (compute the color of each pixel in) a rectangular section. In this case we will make a single call to raytrace from (0,0) to (width, height) exclusively.
Code To Investigate
RayTraceContext
RayTraceContext |
---|
public interface RayTraceContext {
int width();
int height();
void mark(int xMin, int yMin, int xMaxExclusive, int yMaxExclusive);
void rayTrace(int xMin, int yMin, int xMaxExclusive, int yMaxExclusive);
}
|
The width and height methods should be pretty self explanatory. They return the width and height of the complete window to raytrace.
The raytrace method computes the colors for all of the pixels in the rectangle from (xMin, yMin) to (xMaxExclusive, yMaxExclusive) exclusively.
The mark method is not needed here. The mark method can be useful for visualization of which processors are assigned to different rectangles in the divide and conquer parallel raytracer in the exercise to follow.
Code To Implement
SequentialRayTracer
class: | SequentialRayTracer.java | ![]() |
methods: | rayTrace | |
package: | raytrace.group | |
source folder: | student/src/main/java |
method: public void rayTrace(RayTraceContext context, Scheduler scheduler)
(sequential implementation only)
Since this is the SequentialRayTracer we will not need to use the scheduler. The rayTrace, width, and height methods on RayTraceContext should be useful here.
Checking Your Solution
Visualization
class: | RayTracerViz.java | VIZ |
package: | raytrace.viz | |
source folder: | student/src/main/java |
Clicking on the SEQUENTIAL button will allow you to see your work.
Correctness
class: | _SequentialRayTracerTestSuite.java | ![]() |
package: | raytrace.group | |
source folder: | testing/src/test/java |