Newsgroups: comp.graphics Path: utzoo!utgpu!watserv1!watcgl!pfbertnd From: pfbertnd@watcgl.waterloo.edu (Philippe F. Bertrand) Subject: Re: Polygon orientation test ? Message-ID: <1990Oct28.160039.19901@watcgl.waterloo.edu> Organization: University of Waterloo References: <4158.272311a1@cc.curtin.edu.au> <1728@wet.UUCP> Date: Sun, 28 Oct 90 16:00:39 GMT Lines: 24 In article <1728@wet.UUCP> smiller@wet.UUCP (Gregory Shane Miller) writes: > >Note saying, given any three points from a polygon, eval this 3x3 >matrix (eg. find det of the 3x3 matrix). If returns the twice the >signed area of the three points (eg a triangle). The sign of the >result tells whether it's oriented CW or CCW. This algorithm only works on concave polygons! ie it will not work for (0,0), (1,1), (0,2), (2,2), (2,0) = square with a chunk removed your algorithm using the first 3 points will return CCW when in fact it is CW This is important for hidden surface algorithms in 3D where a face of an object has all the perspective and view operations performed on it resulting in a 2D polygon. If all faces originally appear CW when they are facing you, hidden surfaces will be CCW after the view transformations. Previously posted solutions appeared correct. > >G. Shane Miller [ smiller@wet.UUCP ] Von Neumann eat your heart out! - Philip F. Bertrand pfbertrand@violet.waterloo.edu Computer Graphics Lab, or pfbertnd@watcgl.waterloo.edu Department of Computer Science, University of Waterloo Waterloo, Canada N2L 3G1