Re: [Algorithms] Polygon clipping
Brought to you by:
vexxed72
From: Klaus H. <k_h...@os...> - 2000-07-26 13:37:29
|
----- Original Message ----- From: Brian Marshall <bma...@ra...> To: <gda...@li...> Sent: Wednesday, July 26, 2000 2:39 PM Subject: RE: [Algorithms] Polygon clipping > Different from the normal. I was assuming that the fan was for a convex > polygon. DOH! For a convex polygon the vertices are in fan order anyway and > remain so after clipping. This example is not convex so I guess you could > use more general polygon clipping. The point is this... I intend to write a polygon clipper for 2D games using the 3D hardware (the vertices are already in screen space). Of course, in 2D games, polygons are usually convex (like particles, or simple textured blocks), but... In my opinion, polygon clipping is not exactly one of the most interesting topics, and thus I want to write a clipper that handles all the standard primitive types (concave, and convex), and never think about it again. Actually, this is one of those rare cases where I'd say "source code appreciated" ;-) > Sutherland-Hodgham will clip concave > polygons, in this case giving 2 polygons out, or a degenerate triangle (zero > area) connecting the 2 fragments. There is some info on this in FvD etc. Yes, I do have all these standard books, like the Graphics Gems, FvDFH, and so on... but they are pretty old. Of course, 'old' doesn't make them bad, but I'd like to know if there are newer/better/faster clipping algorithms than Sutherland Hodgman and the like, before I start to implement an 'old' algorithm. Maybe some clipping algorithm that operates in screen space? (i.e. no need for back-transforms) Anyway, I'll now move over to a D3D group for my API-specific questions, and try to ask non-API-specific questions here. Thanks, Niki > If your generating the strips/fans offline it may be worthwhile only > allowing convex fans - you'd have to time the benefits of bigger fans > against more complex clipping code. > > -Brian. |