Graphics Reference
In-Depth Information
Start Pt:
This should let the user to graphically pick a point p on the screen.
Direction:
This should ask the user for an angle q.
Start:
This should start drawing the ray from p in the direction defined by q. The ray
should continue, reflecting off of any polygonal curves and circles in the world,
until the user presses a key. If a ray does not meet any object, that is, it is about
to escape to “infinity,” draw a short segment in that direction and then stop after
telling the user what has happened. Alternatively, rather than waiting for a key to
be pressed ask for a number k and quit drawing the ray after k reflections.
Be sure to include a delay each time the ray hits an object so that one can
watch the ray trace out its path in the world. Without this, the whole process will
happen so fast that one would only see a “final” picture.
Example:
This would display a sample world of objects for the user to use in this ray tracing
exercise.
An additional nice option in your program would be to allow the user to create his/her own
world of circles and closed or open polygons in the plane.
Search WWH ::




Custom Search