|
|
|
"...ut in omnibus glorificetur Deus."
(...that in all things God may be glorified.)
Rule of St. Benedict (RB 57:9)
Vector2 class with functionality similar to what was on the exam.
You should have vector arithmetic, dot products, and perp. You may also encode orthogonal
projections and reflections into the vector, if you'd like.
Polygon and Shape classes from HW2.
Shape and Polygon classes a new function which
you will use to determine the hit time of a ray into your Shape. This function will be
slightly different from what is described in the book. Its prototype should be the following:bool rayHit(Ray thisRay, double &tHit, Vector2 normal);
Polygon so that it stores the normals to each line segment. You should
compute these normals as points are entered. You can compute the first normal after the 2nd point
has been entered. Then, the ith line segment will be described in point-normal form
by (normals[i], points[i]).
rayHit function, you need to use an auxiliary, private
function bool rayHitAux(Ray thisRay, int which, double &tHit); to test each line segment
thisRay and each line segment in your Polygon.tHit.falserayHit, you must keep track of which incoming hit has the highest (positive) value.normal and tHit
for the highest tHit and true
false rayHit to find the hit time for each polygon, you need to keep track of the lowest
(positive) hit time and corresponding normal vector.
thisRay's vector and the normal vector to determine the reflection vector.tHit in thisRay you may find the point of intersection.Vector2 in a text program.
myDisplay function, hard-code the sample Polygon
by hand. Create the Ray by hand and call the poly's rayHit routine with your sample ray. Once you
get that working, then start to generalize.
hw3" in your cs251 homework directory.