RE: [Algorithms] Polygon clipping
Brought to you by:
vexxed72
From: Brian M. <bma...@ra...> - 2000-08-01 17:11:53
|
There are 2 cases for fans. The first is where the first vertex is on the edge of the fan. In this case the list of fan vertices is just a convex polygon. This is what I tend to think of as fans. They output of clipping to a convex boundary will remain a fan. The second type of fan is one where the first vertex is in the middle of the fan rather than being on the edge. I think you're right that in this case the clipping won't produce a single fan. For generating fans offline you could test whether the angle between the first and last edges from the common vertex is greater that 180 degrees if the triangles are planar. If it is less than 180 degrees then its the first type of fan and normal polygon clipping against a convex boundary will take a fan and produce at most one fan. I can't think of any algorithm I've come across off hand that handles clipping type 2 fans...I think it might have to be done using something similar to the clipping techniques for concave polygons - if you think of a type 1 vrs type 2 fan then type 1 is convex and type 2 is concave. (Trace the edges between successive vertices to get the idea). I'm glad I don't have to deal with type 2! -Brian. > -----Original Message----- > From: gda...@li... > [mailto:gda...@li...]On Behalf Of Aaron > Drew > Sent: Wednesday, July 26, 2000 12:02 PM > To: gda...@li... > Subject: RE: [Algorithms] Polygon clipping > > > I might be overlooking something here but I can imagine a case where a fan > would not remain a fan after clipping that might complicate this method. > > What happens when the centre of the fan is out of the view > frustum? I can't > see how the fan can be preserved. It would be cut into a series of quads > which would no longer share a common vertex. Unless I'm thinking of > something wrongly, these can't be arranged in a fan-like fashion. > > - Aaron > > > -----Original Message----- > > From: gda...@li... > > [mailto:gda...@li...]On Behalf Of Tom > > Forsyth > > Sent: Wednesday, July 26, 2000 7:50 PM > > To: gda...@li... > > Subject: RE: [Algorithms] Polygon clipping > > > > > > > > Fans remain fans (though it may be knarly to find the ordering), strips > > don't - they can become multiple strips (think about a U-shaped > > strip where > > the bottom of the U is off-screen). > > > > You might also want to try sending objects that intersect the > > frustum edges > > through the non-VB path, so that D3D clips them for you - it's actually > > pretty fast. Things that don't need clipping should still go > > through the VB > > path of course. > > > > Oh, and I really recommend indexed lists instead of lots of > little strips > > and fans - you get far too many D3D calls that way, and if > you're going to > > do your own clipping, indexed lists are very easy to handle. > > > > Tom Forsyth - Muckyfoot bloke. > > Whizzing and pasting and pooting through the day. > > > > > -----Original Message----- > > > From: Klaus Hartmann [mailto:k_h...@os...] > > > Sent: 25 July 2000 23:49 > > > To: gda...@li... > > > Subject: [Algorithms] Polygon clipping > > > > > > > > > Hi all, > > > > > > Even though this is not an API-specific question, I'd like to use an > > > API-specific example to explain my problem. > > > > > > In Direct3D, when using *vertex buffer* with pre-transformed > > > and pre-lit > > > vertices, then Direct3D does not perform any clipping. So I > > > have to do this > > > myself. I could probably go ahead an clip single triangles > > > with a Sutherland > > > Hodgman algorithm, but... > > > > > > How do you people clip triangle strips and triangle fans? Is > > > it possible to > > > clip them so, that strips remain strips, and fans remain > > > fans, or is this > > > impossible? > > > > > > Also, which is the prefered clipping algorithm? Is it > > > Sutherland Hodgman? > > > > > > When you answer, please keep in mind that I also need to clip texture > > > coordinates and the diffuse/specular colors. > > > > > > Any help is greatly appreciated, > > > Niki > > > > > > > > > _______________________________________________ > > > GDAlgorithms-list mailing list > > > GDA...@li... > > > http://lists.sourceforge.net/mailman/listinfo/gdalgorithms-list > > > > > > > _______________________________________________ > > GDAlgorithms-list mailing list > > GDA...@li... > > http://lists.sourceforge.net/mailman/listinfo/gdalgorithms-list > > > > > _______________________________________________ > GDAlgorithms-list mailing list > GDA...@li... > http://lists.sourceforge.net/mailman/listinfo/gdalgorithms-list > |