vlookup.h
Go to the documentation of this file.
00001 #ifndef VLOOKUP_H
00002 
00003 #define VLOOKUP_H
00004 
00060 // CodeSnippet provided by John W. Ratcliff
00061 // on March 23, 2006.
00062 //
00063 // mailto: jratcliff@infiniplex.net
00064 //
00065 // Personal website: http://jratcliffscarab.blogspot.com
00066 // Coding Website:   http://codesuppository.blogspot.com
00067 // FundRaising Blog: http://amillionpixels.blogspot.com
00068 // Fundraising site: http://www.amillionpixels.us
00069 // New Temple Site:  http://newtemple.blogspot.com
00070 //
00071 // This snippet shows how to 'hide' the complexity of
00072 // the STL by wrapping some useful piece of functionality
00073 // around a handful of discrete API calls.
00074 //
00075 // This API allows you to create an indexed triangle list
00076 // from a collection of raw input triangles.  Internally
00077 // it uses an STL set to build the lookup table very rapidly.
00078 //
00079 // Here is how you would use it to build an indexed triangle
00080 // list from a raw list of triangles.
00081 //
00082 // (1) create a 'VertexLookup' interface by calling
00083 //
00084 //     VertexLook vl = Vl_createVertexLookup();
00085 //
00086 // (2) For each vertice in each triangle call:
00087 //
00088 //     unsigned int i1 = Vl_getIndex(vl,p1);
00089 //     unsigned int i2 = Vl_getIndex(vl,p2);
00090 //     unsigned int i3 = Vl_getIndex(vl,p3);
00091 //
00092 //     save the 3 indices into your triangle list array.
00093 //
00094 // (3) Get the vertex array by calling:
00095 //
00096 //     const double *vertices = Vl_getVertices(vl);
00097 //
00098 // (4) Get the number of vertices so you can copy them into
00099 //     your own buffer.
00100 //     unsigned int vcount = Vl_getVcount(vl);
00101 //
00102 // (5) Release the VertexLookup interface when you are done with it.
00103 //     Vl_releaseVertexLookup(vl);
00104 //
00105 // Teaches the following lessons:
00106 //
00107 //    How to wrap the complexity of STL and C++ classes around a
00108 //    simple API interface.
00109 //
00110 //    How to use an STL set and custom comparator operator for
00111 //    a complex data type.
00112 //
00113 //    How to create a template class.
00114 //
00115 //    How to achieve significant performance improvements by
00116 //    taking advantage of built in STL containers in just
00117 //    a few lines of code.
00118 //
00119 //    You could easily modify this code to support other vertex
00120 //    formats with any number of interpolants.
00121 //
00122 //    Hide C++ classes from the rest of your application by
00123 //    keeping them in the CPP and wrapping them in a namespace
00124 // Uses an STL set to create an index table for a bunch of vertex positions
00125 // used typically to re-index a collection of raw triangle data.
00126 
00127 namespace ConvexDecomposition
00128 {
00129 
00130 typedef void * VertexLookup;
00131 
00132 VertexLookup  Vl_createVertexLookup(void);
00133 void          Vl_releaseVertexLookup(VertexLookup vlook);
00134 
00135 unsigned int  Vl_getIndex(VertexLookup vlook,const double *pos);  // get index.
00136 const double * Vl_getVertices(VertexLookup vlook);
00137 
00138 unsigned int  Vl_getVcount(VertexLookup vlook);
00139 
00140 };
00141 
00142 
00143 #endif


convex_decomposition
Author(s): John W. Ratcliff
autogenerated on Sat Jun 8 2019 20:01:17