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 
32 struct SbTVertex;
33 class SbHeap;
34 class SbVec3f;
35 
36 typedef void SbTesselatorCB(void * v0, void * v1, void * v2, void * data);
37 
38 class COIN_DLL_API SbTesselator {
39 public:
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 
49 private:
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
SbTesselator
The SbTesselator class is used to tessellate polygons into triangles.
Definition: SbTesselator.h:38
SbTesselator::setCallback
void setCallback(SbTesselatorCB *func, void *data)
Definition: SbTesselator.cpp:401
SbSphere::circumscribe
void circumscribe(const SbBox3f &box)
Definition: SbSphere.cpp:136
SbTesselator::~SbTesselator
~SbTesselator(void)
Definition: SbTesselator.cpp:192
SbList::truncate
void truncate(const int length, const int dofit=0)
Definition: SbList.h:149
SbBox3f
The SbBox3f class is an abstraction for an axis aligned 3 dimensional box.
Definition: SbBox3f.h:37
SoDebugError::postWarning
static void postWarning(const char *const source, const char *const format,...)
Definition: SoDebugError.cpp:324
SbList::append
void append(const Type item)
Definition: SbList.h:98
SbTesselator::beginPolygon
void beginPolygon(SbBool keepVertices=0, const SbVec3f &normal=SbVec3f(0.0f, 0.0f, 0.0f))
Definition: SbTesselator.cpp:213
SbList< int >
SbBox3f::makeEmpty
void makeEmpty(void)
Definition: SbBox3f.cpp:424
SbSphere
The SbSphere class is a representation of a sphere.
Definition: SbSphere.h:33
SbList::getLength
int getLength(void) const
Definition: SbList.h:145
SbVec3f::setValue
SbVec3f & setValue(const float v[3])
Definition: SbVec3f.cpp:461
SbBSPTree
The SbBSPTree class provides a binary space partitioning container.
Definition: SbBSPTree.h:45
SbTesselator::SbTesselator
SbTesselator(SbTesselatorCB *func=NULL, void *data=NULL)
Definition: SbTesselator.cpp:177
SbTesselator::addVertex
void addVertex(const SbVec3f &v, void *data)
Definition: SbTesselator.cpp:234
SbVec3f
The SbVec3f class is a 3 dimensional vector with floating point coordinates.
Definition: SbVec3f.h:37
SbVec3f::normalize
float normalize(void)
Definition: SbVec3f.cpp:436
SbTesselator::endPolygon
void endPolygon(void)
Definition: SbTesselator.cpp:261
SbBox3f::extendBy
void extendBy(const SbVec3f &point)
Definition: SbBox3f.cpp:178

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

Generated on Wed Jul 24 2019 for Coin by Doxygen. 1.8.17