home *** CD-ROM | disk | FTP | other *** search
/ Cutting-Edge 3D Game Programming with C++ / CE3DC++.ISO / BOOK / CHAP11 / MORPH / POINT3D.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1995-11-09  |  1.2 KB  |  50 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. #ifndef POINT3DHPP
  16.   #define POINT3DHPP
  17.   #include "Point3D.HPP"
  18. #endif
  19.  
  20. // Function designed to search through List in an attempt
  21. // to determine uniqueness of vertex V:
  22. int UniqueVert ( Point3D &V, Point3D *List, int Range )
  23.   {
  24.   // Loop through list of vertices:
  25.   for ( int Count = 0; Count < Range; Count++ )
  26.       {
  27.       // If it's not unique, return false:
  28.       if ( V == List [ Count ] )
  29.          return 0;
  30.       }
  31.   // Return true (it's unique):
  32.   return 1;
  33.   }
  34.  
  35. // Function designed to search through List in an attempt
  36. // to locate the index of a vertex that matches V:
  37. unsigned int GetVertIndex ( Point3D &V, Point3D *List, unsigned int Range )
  38.   {
  39.   // Loop through the list of vertices:
  40.   for ( unsigned int Count = 0; Count < Range; Count++ )
  41.       {
  42.       // If the vertex matches, return the index:
  43.       if ( V == List [ Count ] )
  44.          return Count;
  45.       }
  46.   // Return zero as default - Note: this code should
  47.   // never be reached.
  48.   return 0;
  49.   }
  50.