home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / graphics / 11914 < prev    next >
Encoding:
Internet Message Format  |  1992-11-15  |  1.3 KB

  1. Path: sparky!uunet!ogicse!news.u.washington.edu!stein.u.washington.edu!chuckb
  2. From: chuckb@stein.u.washington.edu (Charles Bass)
  3. Newsgroups: comp.graphics
  4. Subject: Re: Point inside a triangle
  5. Message-ID: <1992Nov16.041020.28568@u.washington.edu>
  6. Date: 16 Nov 92 04:10:20 GMT
  7. Article-I.D.: u.1992Nov16.041020.28568
  8. References: <7bv1svg@rpi.edu> <PINKAS.92Nov15155005@skywalker.intel.com>
  9. Sender: news@u.washington.edu (USENET News System)
  10. Organization: University of Washington
  11. Lines: 21
  12.  
  13. The way I determine if a point is within a triangle is using the
  14. cross-product test.  However, it is not as expesive as one
  15. might think, especially if you have normal information (if you
  16. don't you must take another cross product).
  17.  
  18. The ideas is to project the problem from 3D into 2D.  If you
  19. have the normal you can choose the axis to ignore by ignoring
  20. the component with the largest magnitude. So if your vector is:
  21.      normal = [1,2,-3]
  22. You would ignore the z components of the points. This reduces each
  23. cross-product to two multiplies and a subract as opposed to 6
  24. multiplies and two subracts.
  25.  
  26. The simplification to 2D makes life simpler.  I found when I
  27. implemented this "stuff" that I had to be real careful with
  28. numerical precision issues! 
  29.  
  30. Hope this helps some one.
  31.  
  32. Later-
  33.     chuckb
  34.