home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.graphics
- Path: sparky!uunet!news.smith.edu!orourke
- From: orourke@sophia.smith.edu (Joseph O'Rourke)
- Subject: Re: Point inside a triangle
- Message-ID: <1992Nov16.013915.18762@sophia.smith.edu>
- Organization: Smith College, Northampton, MA, US
- References: <7bv1svg@rpi.edu> <PINKAS.92Nov15155005@skywalker.intel.com>
- Date: Mon, 16 Nov 1992 01:39:15 GMT
- Lines: 22
-
- In article <PINKAS.92Nov15155005@skywalker.intel.com> pinkas@skywalker.intel.com (Israel Pinkas) writes:
- >bohn@ptolemy2.rdrc.rpi.edu (Jan Helge Bhn) writes:
- >
- > Does anyone have any suggestions on how to check if a point is located
- > inside a triangle, accurately and fast.
- >
- >[...]
- >In the case of a point outside the triangle, determine the sign of the
- >area. Then substitute the new point for each of the vertices of the
- >triangle. If the sign changes, the point is outside the triangle.
-
- When you substitute the point outside (call it x) for one of the
- three triangle vertices (call them a,b,c), you are computing the signed
- area of the triangles (x,a,b), (x,b,c), and (x,c,a). Each of
- these areas is the crossproduct of (a-x) and (b-x), etc. So this
- method is equivalent to what Jan intimated he was already using
- (although he didn't detail his method).
- I don't think the problem can be solved without multiplying
- coordinates of points. It seems the simplest algorithm to understand
- simply requires x to be left of the directed lines through
- ab, bc, and ca, which is exactly what you are doing with your area
- calculations.
-