AngleRaysCirc Documentation

The code presented in AngleRaysCirc.cpp is used to generate a postscript file with a drawing of a set of rays reflecting off a given set of circles. The input file contains the number of circles, the coordinates of their centers and their radii, the number of rays, the coordinates of the source of light, the start angle and the cone spread angle, in degrees. In order to shoot just one ray at a certain angle, one can input "1" for the number of rays, and use the start angle to direct the ray.


Executing the program

The Makefile:

AngleRaysCirc: AngleRaysCirc.o
g++ -o AngleRaysCirc AngleRaysCirc.o
AngleRaysCirc.o: AngleRaysCirc.cpp
g++ -c AngleRaysCirc.cpp
rm AngleRaysCirc.o AngleRaysCirc

To run:

% AngleRaysCirc < file.input >

Alternately, one does not have to run the program with an input file but it is necessary that an output postscript file be specified in order to view the saved image. Otherwise, the data is simply output to the screen and not saved.

There is also the option to run the program with debugging output. To do so:

% AngleRaysCirc [d] [D] < file.input >

Sample input file:

This input file will draw three circles in the shape of an equilateral triangle with five point gaps between each circle. A light source will be generated in the center of the triangle emitting five rays over a span of fifty degrees, each ray five degrees apart. For added clarity, the light ray source is encircled by blue.

Input file (file.input)

0 0 195
400 0 195
200 346 195
200 100
5 50

The Postscript Image (

Return to main page