Got an iPhone or iPad? We have a brand new Pastebin App for both devices, and it's totally free! Click here to download the new Pastebin App for iOS.
Guest

sam

By: a guest on Feb 9th, 2010  |  syntax: None  |  size: 0.72 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse
Copied
  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.                          }