home *** CD-ROM | disk | FTP | other *** search
/ Cutting-Edge 3D Game Programming with C++ / CE3DC++.ISO / BOOK / CHAP08 / POINT3D.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-15  |  1.2 KB  |  47 lines

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