home *** CD-ROM | disk | FTP | other *** search
/ Cutting-Edge 3D Game Programming with C++ / CE3DC++.ISO / BOOK / CHAP12 / POINT2D.CPP < prev    next >
C/C++ Source or Header  |  1996-01-24  |  1KB  |  42 lines

  1. //
  2. // File name: Poin2D.CPP
  3. //
  4. // Description: Support file for the Point2D.HPP header file
  5. //
  6. // Author: John De Goes
  7. //
  8. // Project: Cutting Edge 3D Game Programming
  9. //
  10.  
  11. #include "Point2D.HPP"
  12.  
  13. // Function designed to search through List in an attempt
  14. // to determine uniqueness of vertex V:
  15. int UniqueVert ( Point2D &V, Point2D *List, int Range )
  16.   {
  17.   // Loop through list of vertices:
  18.   for ( int Count = 0; Count < Range; Count++ )
  19.       {
  20.       // If it's not unique, return false:
  21.       if ( V == List [ Count ] )
  22.          return 0;
  23.       }
  24.   // Return true (it's unique):
  25.   return 1;
  26.   }
  27.  
  28. // Function designed to search through List in an attempt
  29. // to locate the index of a vertex that matches V:
  30. unsigned int GetVertIndex ( Point2D &V, Point2D *List, unsigned int Range )
  31.   {
  32.   // Loop through the list of vertices:
  33.   for ( unsigned int Count = 0; Count < Range; Count++ )
  34.       {
  35.       // If the vertex matches, return the index:
  36.       if ( V == List [ Count ] )
  37.          return Count;
  38.       }
  39.   // Return zero as default - Note: this code should
  40.   // never be reached.
  41.   return 0;
  42.   }