I'm dealing with hardware that uses quads as its polygonal primitive. Not triangles. A triangle can be expressed by setting 2 of the 4 vertices equal to each other for a degenerate quad.

For the 3D engine, I'm in need of clipping for polygons outside of clip space volume in order to avoid vertex inversion and division by zero errors when performing the perspective divide.

My logic is that I first identify the primitives that intersect with the 6 planes. From there I add edges to cut the primitive. What I don't understand at this point is how to cut/add quads. Do I need to "triangulate", but for quads? Is it possible? Are there constraints other than the quad needing to be convex?

Edit: I might be over complicating this. I can't come up with a case where I get less than 4 or more than 4 vertices when clipping. The only case is when all points are outside the clipping area, all except one edge. That edge would produce a triangle.

  • $\begingroup$ What about when 2 vertices are outside the clipping area and the other 2 are inside? You can end up with a pentagon or hexagon inside. Or when 2 are outside one corner and the other 2 are outside the opposite corner? $\endgroup$ Jul 29, 2017 at 14:33
  • $\begingroup$ Good point... I guess I have to cover these edge cases. $\endgroup$
    – mrkotfw
    Jul 29, 2017 at 20:42
  • $\begingroup$ @user1118321 although if you do the planes one by one you will just split the original quad and have a standard solution again. $\endgroup$
    – joojaa
    Aug 1, 2017 at 13:45
  • $\begingroup$ @joojaa I'm not sure what you mean. What do you mean by standard solution? $\endgroup$
    – mrkotfw
    Aug 3, 2017 at 1:12


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.