| http://www.sim.no/ http://www.coin3d.org/

SbClip.h
1 #ifndef COIN_SBCLIP_H
2 #define COIN_SBCLIP_H
3
4 /**************************************************************************\
5 *
6 * This file is part of the Coin 3D visualization library.
7 * Copyright (C) by Kongsberg Oil & Gas Technologies.
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * ("GPL") version 2 as published by the Free Software Foundation.
12 * See the file LICENSE.GPL at the root directory of this source
13 * distribution for additional information about the GNU GPL.
14 *
15 * For using Coin with software that can not be combined with the GNU
16 * GPL, and for taking advantage of the additional benefits of our
17 * support services, please contact Kongsberg Oil & Gas Technologies
18 * about acquiring a Coin Professional Edition License.
19 *
20 * See http://www.coin3d.org/ for more information.
21 *
22 * Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY.
23 * http://www.sim.no/ sales@sim.no coin-support@coin3d.org
24 *
25 \**************************************************************************/
26
27 #include <Inventor/lists/SbList.h>
28 #include <Inventor/SbVec3f.h>
29 #include <stddef.h>
30
31 class SbPlane;
32 class SbVec2f;
33
34 typedef void * SbClipCallback(const SbVec3f & v0, void * vdata0,
35 const SbVec3f & v1, void * vdata1,
36 const SbVec3f & newvertex,
37 void * userdata);
38
39 class COIN_DLL_API SbClip {
40 public:
41 SbClip(SbClipCallback * callback = NULL, void * userdata = NULL);
42
43 void addVertex(const SbVec3f &v, void * vdata = NULL);
44 void reset(void);
45
46 void clip(const SbPlane & plane);
47
48 int getNumVertices(void) const;
49 void getVertex(const int idx, SbVec3f & v, void ** vdata = NULL) const;
50 void * getVertexData(const int idx) const;
51
52 private:
53 class SbClipData {
54 public:
55 SbClipData(void) {}
56 SbClipData(const SbVec3f & v, void * data)
57 : vertex(v),
58 data(data) {}
59 public:
60 void get(SbVec3f &v, void *& dataref) {
61 v = this->vertex;
62 dataref = this->data;
63 }
64
65 SbVec3f vertex;
66 void * data;
67 };
68
69 SbClipCallback * callback;
70 void * cbdata;
71 SbList <SbClipData> array[2];
72 int curr;
73 void outputVertex(const SbVec3f &v, void * data);
74 };
75
76
77 #endif // !COIN_SBCLIP_H
SbVec2f
The SbVec2f class is a 2 dimensional vector with floating point coordinates.This vector class is used...
Definition: SbVec2f.h:39
SbList< SbClipData >
SbClip
The SbClip class is a generic polygon clipper class.It is used by first adding all vertices in the po...
Definition: SbClip.h:39
SbVec3f
The SbVec3f class is a 3 dimensional vector with floating point coordinates.This vector class is used...
Definition: SbVec3f.h:40
SbPlane
The SbPlane class represents a plane in 3D space.SbDPPlane is used by many other classes in Coin...
Definition: SbPlane.h:34

Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.