Topic : S-Buffer FAQ
Author : Paul Nettle
Page : << Previous 3  Next >>
Go to page :


     Case 3c:
         ->         ccccccccc
         -> nnnnnnnnnnnnnnnnn

      Case 3d:
         ->    ccccccccccc
         -> nnnnnnnnnnnnnnnnn

      Case 3e:
         ->       c
         -> nnnnnnnnnnnnn

      Case 3f:
         ->             c
         -> nnnnnnnnnnnnn

      Case 4a:
         -> ccccccccccccc
         ->   nnnnnnnn

      Case 4b:
         -> ccccccccccccc
         ->   nnnnnnnnnnn

      Case 4c:
         -> ccccccccccccc
         ->             n

      Case 4d:
         -> ccccccccccc
         ->   nnnnnnnnnnn

      Case 4e:
         -> ccccccc
         ->       nnnnnnn

      Case 5:
         -> cccccccccccccc
         -> n

      Case 6:
         -> cccccccccccccc
         -> nnnnnnn

      Case 7:
         -> c
         -> nnnnnnnnnnnnn

      Case 8:
         -> ccccccc
         -> nnnnnnnnnnnnnn

      Case 9:
         ->       c
         ->       n

      Case 10:
         -> cccccccccccccc
         -> nnnnnnnnnnnnnn


Psudo-code for a rudimentary insertion routine begins here


   if (New is entirely off-screen)
      return;

   // Make sure segment is sorted left-right

   if (the list is empty)
   {
      just add it
   }

   while(we still have entries in the list)
   {
      // Case 1
      if (New.x1 > Cur.x2)
      {
         // Next Cur
         // Continue Checking
      }
      // Simply off-screen? (do this check again 'cause New is changin')
      else if (New.x1 >= ScreenResX || New.x2 < 0)
      {
         // Return
      }
      // Case 2
      else if (New.x2 < Cur.x1)
      {
         // Add New before Cur;
         // Return
      }
      // Case 3
      else if (New.x1 < Cur.x1)
      {
         // Split New at Cur's left-most point
         // Add New's left-half before Cur
         // Replace New with it's right half
         // Continue checking
      }
      // Case 4
      else if (Cur.x1 < New.x1)
      {
         // Split Cur at New's left-most point
         // Add Cur's right-half after Cur
         // Next Cur
         // Continue checking
      }
      // Cases 5 & 6
      else if (Cur.x2 > New.x2)
      {
         // Case 5
         if (New.x1 == New.x2)
         {
            // If New's starting Z is behind Cur's starting Z, just return
            // Split Cur at New's right-most point + 1
            // Replace Cur with it's right half
            // Add New before Cur
            // Return
         }
         else
         // Case 6
         {
            // Split Cur at New's right-most point + 1
            // Replace Cur with it's right half
            // Call IntersectSplit for New and Cur's left-half
            // Return
         }

      }
      // Cases 7 & 8
      else if (Cur.x2 < New.x2 )
      {
         // Case 7
         if (Cur.x1 == Cur.x2)
         {
            // Split New at Cur's right-most point + 1
            // If Cur is behind New's left-half, replace Cur with New's left-half
            // Continue checking using New's right half
         }
         // Case 8
         else
         {
            // Split New at Cur's right-most point + 1
            // Remove Cur from the list
            // Call IntersectSplit for Cur and New's left-half
            // Continue checking using New's right-half
         }
      }
      // Cases 9 & 10
      else
      {
         // Case 9
         if (Cur.x1 == Cur.x2)
         {
            // If Cur is behind New, replace Cur with New
            // Return
         }
         // Case 10
         else
         {
  


Page : << Previous 3  Next >>