Advertisement
Guest User

Untitled

a guest
Oct 21st, 2014
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. bool polygon::Intersect(const ray &R, intersection &inter)
  2. {
  3. // To Do: If you have implemented the "CalculateNormal" method
  4. // below, should already be calculated and placed in the member
  5. // "n".
  6. //
  7. // Now, using n, you need to calculate the intersection of the
  8. // ray with the plane containing the polygon. Then, once you
  9. // have that point, you need to loop through each edge in the
  10. // polygon and make sure the point is to the left of that edge.
  11. //
  12. // If it is to the left of every edge, then fill the structure
  13. // inter with all of the data for the intersection and return
  14. // true, if not, return 0.
  15. //
  16. // Don't forget to check to see if the t you calculate for the
  17. // ray is > 0.
  18.  
  19. return false;
  20. }
  21.  
  22. void polygon::CalculateNormal(void)
  23. {
  24. // To Do: Use the edges of the polygon to calculate the normal
  25. // of the polygon. You should be careful to take care of the
  26. // case where two edges give you a zero normal. Place the
  27. // normal into the member "n" so that the intersection method
  28. // can use it when called.
  29. //
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement