AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
vlookup.h
Go to the documentation of this file.
1/*
2Copyright 2007-2024. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
17/*
18This source code has been taken and modified by Algoryx Simulation AB
19from the source and under the license given below.
20*/
22
23#ifndef VLOOKUP_H
24
25#define VLOOKUP_H
26
82// CodeSnippet provided by John W. Ratcliff
83// on March 23, 2006.
84//
85// mailto: jratcliff@infiniplex.net
86//
87// Personal website: http://jratcliffscarab.blogspot.com
88// Coding Website: http://codesuppository.blogspot.com
89// FundRaising Blog: http://amillionpixels.blogspot.com
90// Fundraising site: http://www.amillionpixels.us
91// New Temple Site: http://newtemple.blogspot.com
92//
93// This snippet shows how to 'hide' the complexity of
94// the STL by wrapping some useful piece of functionality
95// around a handful of discrete API calls.
96//
97// This API allows you to create an indexed triangle list
98// from a collection of raw input triangles. Internally
99// it uses an STL set to build the lookup table very rapidly.
100//
101// Here is how you would use it to build an indexed triangle
102// list from a raw list of triangles.
103//
104// (1) create a 'VertexLookup' interface by calling
105//
106// VertexLook vl = Vl_createVertexLookup();
107//
108// (2) For each vertex in each triangle call:
109//
110// unsigned int i1 = Vl_getIndex(vl,p1);
111// unsigned int i2 = Vl_getIndex(vl,p2);
112// unsigned int i3 = Vl_getIndex(vl,p3);
113//
114// save the 3 indices into your triangle list array.
115//
116// (3) Get the vertex array by calling:
117//
118// const double *vertices = Vl_getVertices(vl);
119//
120// (4) Get the number of vertices so you can copy them into
121// your own buffer.
122// unsigned int vcount = Vl_getVcount(vl);
123//
124// (5) Release the VertexLookup interface when you are done with it.
125// Vl_releaseVertexLookup(vl);
126//
127// Teaches the following lessons:
128//
129// How to wrap the complexity of STL and C++ classes around a
130// simple API interface.
131//
132// How to use an STL set and custom comparator operator for
133// a complex data type.
134//
135// How to create a template class.
136//
137// How to achieve significant performance improvements by
138// taking advantage of built in STL containers in just
139// a few lines of code.
140//
141// You could easily modify this code to support other vertex
142// formats with any number of interpolants.
143//
144// Hide C++ classes from the rest of your application by
145// keeping them in the CPP and wrapping them in a namespace
146// Uses an STL set to create an index table for a bunch of vertex positions
147// used typically to re-index a collection of raw triangle data.
148
149namespace ConvexDecomposition
150{
151
152 typedef void * VertexLookup;
153
154 VertexLookup Vl_createVertexLookup(void);
155 void Vl_releaseVertexLookup(VertexLookup vlook);
156
157 unsigned int Vl_getIndex(VertexLookup vlook,const double *pos); // get index.
158 const double * Vl_getVertices(VertexLookup vlook);
159
160 unsigned int Vl_getVcount(VertexLookup vlook);
161
162}
163
164
165#endif