Coin Logo http://www.sim.no
http://www.coin3d.org

SbTesselator.h
1#ifndef COIN_SBTESSELATOR_H
2#define COIN_SBTESSELATOR_H
3
4/**************************************************************************\
5 *
6 * This file is part of the Coin 3D visualization library.
7 * Copyright (C) 1998-2007 by Systems in Motion. All rights reserved.
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 Systems in Motion about acquiring
18 * a Coin Professional Edition License.
19 *
20 * See http://www.coin3d.org/ for more information.
21 *
22 * Systems in Motion, Postboks 1283, Pirsenteret, 7462 Trondheim, NORWAY.
23 * http://www.sim.no/ sales@sim.no coin-support@coin3d.org
24 *
25\**************************************************************************/
26
27#include <Inventor/SbBasic.h>
28#include <Inventor/lists/SbList.h>
29#include <Inventor/SbVec3f.h>
30#include <stddef.h>
31
32struct SbTVertex;
33class SbHeap;
34class SbVec3f;
35
36typedef void SbTesselatorCB(void * v0, void * v1, void * v2, void * data);
37
38class COIN_DLL_API SbTesselator {
39public:
40 SbTesselator(SbTesselatorCB * func = NULL, void * data = NULL);
41 ~SbTesselator(void);
42
43 void beginPolygon(SbBool keepVertices = FALSE,
44 const SbVec3f & normal = SbVec3f(0.0f, 0.0f, 0.0f));
45 void addVertex(const SbVec3f &v, void * data);
46 void endPolygon(void);
47 void setCallback(SbTesselatorCB * func, void * data);
48
49private:
50 struct SbTVertex * newVertex(void);
51 void cleanUp(void);
52
53 int currVertex;
54 SbList <struct SbTVertex*> vertexStorage;
55 SbHeap * heap;
56
57 SbTVertex * headV, * tailV;
58 int numVerts;
59 SbVec3f polyNormal;
60 int X,Y;
61 int polyDir;
62 void (*callback)(void * v0,void * v1,void * v2,void * data);
63 void * callbackData;
64 SbBool hasNormal;
65 SbBool keepVertices;
66
67 void emitTriangle(SbTVertex * v);
68 void cutTriangle(SbTVertex * t);
69 void calcPolygonNormal(void);
70
71 SbBool circleCenter(const SbVec3f &a, const SbVec3f &b,
72 const SbVec3f &c, float &cx, float &cy);
73 float circleSize(const SbVec3f &a, const SbVec3f &b, const SbVec3f &c);
74 float circleSize(SbTVertex * v);
75 float dot2D(const SbVec3f &v1, const SbVec3f &v2);
76 SbBool clippable(SbTVertex * v);
77 SbBool isTriangle(SbTVertex * v);
78 SbBool pointInTriangle(SbTVertex * p, SbTVertex * t);
79 float area(SbTVertex * t);
80
81 static float heap_evaluate(void * v);
82 static int heap_compare(void * v0, void * v1);
83};
84
85#endif // !COIN_SBTESSELATOR_H
The SbTesselator class is used to tessellate polygons into triangles.
Definition SbTesselator.h:38
The SbVec3f class is a 3 dimensional vector with floating point coordinates.
Definition SbVec3f.h:37

Copyright © 1998-2007 by Systems in Motion AS. All rights reserved.

Generated on Wed Jul 17 2024 for Coin by Doxygen. 1.11.0