sam
By: a guest | Feb 9th, 2010 | Syntax:
None | Size: 0.72 KB | Hits: 11 | Expires: Never
if (pIinput->vert[current_vertex].x <= iXBound)
{
// If this vertex off screen - generate clipped vertex to output
// Output.x = xboundary
pOutput->vert[pOutput->nv].x = iXBound;
// output.y = previous y + (x boundary - previous x).(current y - previous y ) / (cqurrent x - previous x) (taken from notes)
pOutput->vert[pOutput->nv].y = pIinput->vert[previous_vertex].y + (iXBound - pIinput->vert[previous_vertex].x) * (pIinput->vert[current_vertex].y - pIinput->vert[previous_vertex].y) / (pIinput->vert[current_vertex].x - pIinput->vert[previous_vertex].x);
pOutput->nv++;
// Copy vertex to output
pOutput->vert[pOutput->nv] = pIinput->vert[current_vertex];
pOutput->nv++;
}