Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool polygon::Intersect(const ray &R, intersection &inter)
- {
- // To Do: If you have implemented the "CalculateNormal" method
- // below, should already be calculated and placed in the member
- // "n".
- //
- // Now, using n, you need to calculate the intersection of the
- // ray with the plane containing the polygon. Then, once you
- // have that point, you need to loop through each edge in the
- // polygon and make sure the point is to the left of that edge.
- //
- // If it is to the left of every edge, then fill the structure
- // inter with all of the data for the intersection and return
- // true, if not, return 0.
- //
- // Don't forget to check to see if the t you calculate for the
- // ray is > 0.
- return false;
- }
- void polygon::CalculateNormal(void)
- {
- // To Do: Use the edges of the polygon to calculate the normal
- // of the polygon. You should be careful to take care of the
- // case where two edges give you a zero normal. Place the
- // normal into the member "n" so that the intersection method
- // can use it when called.
- //
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement