Share Pastebin
Guest
Public paste!

sam

By: a guest | Feb 9th, 2010 | Syntax: None | Size: 0.72 KB | Hits: 11 | Expires: Never
Copy text to clipboard
  1.                         if (pIinput->vert[current_vertex].x <= iXBound)
  2.                         {
  3.                           // If this vertex off screen - generate clipped vertex to output
  4.                           // Output.x = xboundary
  5.  
  6.                                 pOutput->vert[pOutput->nv].x = iXBound;
  7.                                 // output.y = previous y + (x boundary - previous x).(current y - previous y ) / (cqurrent x - previous x) (taken from notes)
  8.                                 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);
  9.                                 pOutput->nv++;
  10.                                 // Copy vertex to output
  11.                                 pOutput->vert[pOutput->nv] = pIinput->vert[current_vertex];
  12.                                 pOutput->nv++;
  13.                          }