There are at least 3 different stages in the rendering pipeline where we do
various forms of clipping.
In the trivial rejection stage we remove objects that cannot be seen.
The clipping stage removes objects and parts of objects that fall outside of the viewing frustum.
And, when rasterizing, clipping is used to remove parts of objects outside of the viewport.
xMin = (int) (v[sort[xflag][0]].x);
xMax = (int) (v[sort[xflag][1]].x + 1);
yMin = (int) (v[sort[yflag][1]].y);
yMax = (int) (v[sort[yflag][0]].y + 1);
/*
clip triangle's bounding box to raster
*/
xMin = (xMin < 0) ? 0 : xMin;
xMax = (xMax >= width) ? width - 1 : xMax;
yMin = (yMin < 0) ? 0 : yMin;
yMax = (yMax >= height) ? height - 1 : yMax;