00001 #ifndef COIN_SBCLIP_H
00002 #define COIN_SBCLIP_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include <Inventor/lists/SbList.h>
00028 #include <Inventor/SbVec3f.h>
00029 #include <stddef.h>
00030
00031 class SbPlane;
00032 class SbVec2f;
00033
00034 typedef void * SbClipCallback(const SbVec3f & v0, void * vdata0,
00035 const SbVec3f & v1, void * vdata1,
00036 const SbVec3f & newvertex,
00037 void * userdata);
00038
00039 class COIN_DLL_API SbClip {
00040 public:
00041 SbClip(SbClipCallback * callback = NULL, void * userdata = NULL);
00042
00043 void addVertex(const SbVec3f &v, void * vdata = NULL);
00044 void reset(void);
00045
00046 void clip(const SbPlane & plane);
00047
00048 int getNumVertices(void) const;
00049 void getVertex(const int idx, SbVec3f & v, void ** vdata = NULL) const;
00050 void * getVertexData(const int idx) const;
00051
00052 private:
00053 class SbClipData {
00054 public:
00055 SbClipData(void) {}
00056 SbClipData(const SbVec3f & v, void * data)
00057 : vertex(v),
00058 data(data) {}
00059 public:
00060 void get(SbVec3f &v, void *& data) {
00061 v = this->vertex;
00062 data = this->data;
00063 }
00064
00065 SbVec3f vertex;
00066 void * data;
00067 };
00068
00069 SbClipCallback * callback;
00070 void * cbdata;
00071 SbList <SbClipData> array[2];
00072 int curr;
00073 void outputVertex(const SbVec3f &v, void * data);
00074 };
00075
00076
00077 #endif // !COIN_SBCLIP_H