Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

SbTesselator.h

00001 /**************************************************************************\
00002  *
00003  *  This file is part of the Coin 3D visualization library.
00004  *  Copyright (C) 1998-2002 by Systems in Motion. All rights reserved.
00005  *
00006  *  This library is free software; you can redistribute it and/or
00007  *  modify it under the terms of the GNU Lesser General Public License
00008  *  version 2.1 as published by the Free Software Foundation. See the
00009  *  file LICENSE.LGPL at the root directory of the distribution for
00010  *  more details.
00011  *
00012  *  If you want to use Coin for applications not compatible with the
00013  *  LGPL, please contact SIM to acquire a Professional Edition license.
00014  *
00015  *  Systems in Motion, Prof Brochs gate 6, 7030 Trondheim, NORWAY
00016  *  http://www.sim.no support@sim.no Voice: +47 22114160 Fax: +47 22207097
00017  *
00018 \**************************************************************************/
00019 
00020 #ifndef COIN_SBTESSELATOR_H
00021 #define COIN_SBTESSELATOR_H
00022 
00023 #include <Inventor/SbBasic.h>
00024 #include <Inventor/lists/SbList.h>
00025 #include <Inventor/SbVec3f.h>
00026 #include <stddef.h>
00027 
00028 struct SbTVertex;
00029 class SbHeap;
00030 class SbVec3f;
00031 
00032 class COIN_DLL_API SbTesselator {
00033 public:
00034   SbTesselator(void (*callback)(void * v0, void * v1, void * v2,
00035                                 void * data) = NULL, void * userdata = NULL);
00036   ~SbTesselator(void);
00037 
00038   void beginPolygon(SbBool keepVertices = FALSE,
00039                     const SbVec3f & normal = SbVec3f(0.0f, 0.0f, 0.0f));
00040   void addVertex(const SbVec3f &v, void *data);
00041   void endPolygon(void);
00042   void setCallback(void (*callback)(void *v0, void *v1, void *v2, void *data),
00043                    void *data);
00044 
00045 private:
00046   struct SbTVertex *newVertex(void);
00047   void cleanUp(void);
00048 
00049   int currVertex;
00050   SbList <struct SbTVertex*> vertexStorage;
00051   SbHeap *heap;
00052 
00053   SbTVertex *headV,*tailV;
00054   int numVerts;
00055   SbVec3f polyNormal;
00056   int X,Y;
00057   int polyDir;
00058   void (*callback)(void *v0,void *v1,void *v2,void *data);
00059   void *callbackData;
00060   SbBool hasNormal;
00061   SbBool keepVertices;
00062 
00063   void emitTriangle(SbTVertex *v);
00064   void cutTriangle(SbTVertex *t);
00065   void calcPolygonNormal(void);
00066 
00067   SbBool circleCenter(const SbVec3f &a, const SbVec3f &b,
00068                       const SbVec3f &c, float &cx, float &cy);
00069   float circleSize(const SbVec3f &a, const SbVec3f &b, const SbVec3f &c);
00070   float circleSize(SbTVertex *v);
00071   float dot2D(const SbVec3f &v1, const SbVec3f &v2);
00072   SbBool clippable(SbTVertex *v);
00073   SbBool isTriangle(SbTVertex *v);
00074   SbBool pointInTriangle(SbTVertex *p,SbTVertex *t);
00075   float area(SbTVertex *t);
00076 
00077   static float heap_evaluate(void *v);
00078 };
00079 
00080 #endif // COIN_SBTESSELATOR_H

Generated at Tue Mar 5 03:31:11 2002 for Coin by doxygen1.2.9 written by Dimitri van Heesch, © 1997-2001