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