VR-Forces 4.0.4 Class Documentation
include/gdb/triangulator.h
Go to the documentation of this file.
00001 /*******************************************************************************
00002 ** Copyright (c) 2006 MAK Technologies, Inc.
00003 ** All rights reserved.
00004 *******************************************************************************/
00005 /*******************************************************************************
00006 ** $RCSfile: triangulator.h,v $ $Revision: 1.8 $ $State: Exp $
00007 *******************************************************************************/
00008 
00009 #ifndef triangulator_H_
00010 #define triangulator_H_
00011 
00012 #include <vector>
00013 #include "gdb/vtxMgr.h"
00014 #include "gdb/gdbDefines.h"
00015 
00018 
00019 enum DtTriangulationResult
00020 {
00021    DtNonFlatPolygon,
00022    DtInvalidZeroNormalPolygon,
00023    DtValidPolygon
00024 };
00025    
00026 
00034 class DT_DLL_gdb DtTriangulator
00035 {
00036 
00037 public:
00038 
00044    static bool triangulateTerrain(DtTerrainDatabase* db);
00045 
00055    static DtTriangulationResult triangulatePolygon(
00056       DtTerrainDatabase* db, 
00057       DtPolygonIndirect* node,
00058       DtGroup* const parent);
00059 
00060 protected:
00061 
00067    static double kross(const DtVertexManager* mgr, int a, int b, int c);
00068 
00073    static bool collinear(const DtVertexManager* mgr, int a, int b, int c);
00074 
00082    static bool segmentInCone(const DtVertexManager* mgr, int v0, int v1, int vm, int vp);
00083 
00089    static bool between(const DtVertexManager* mgr, int a, int b, int c);
00090 
00097    static bool properIntersect(const DtVertexManager* mgr, int a, int b, int c, int d);
00098 
00106    static bool intersect(const DtVertexManager* mgr, int a, int b, int c, int d);
00107 
00114    static bool isDiagonal(const DtVertexManager* mgr, int numberOfVertices, 
00115       std::vector<DtVertexID>& vertIds, int i0, int i1);
00116 
00120    static bool isValidPoly(const DtPolygonIndirect* poly);
00121 
00125    static bool isFlatSurface(const DtPolygonIndirect* poly);
00126 
00129    static void printVerts(std::vector<DtVertexID> lst);
00130 
00141    static void triangulatePolygon(
00142       DtTerrainDatabase* db, 
00143       DtSurfaceID sid, 
00144       const DtVertexManager* mgr, 
00145       DtGroup* const parent,
00146       std::vector<DtVertexID>& vertIds);
00147 
00153    static bool alignPolygonToXYPlane(
00154       DtPolygonIndirect* poly, 
00155       DtHomogeneousTransfMatrix& aMatrix);
00156 
00160    static void transformPolygon(
00161       DtPolygonIndirect* poly, 
00162       DtHomogeneousTransfMatrix& aMatrix);
00163 
00164 protected:
00165 
00166    static const double theErrorMargin;
00167 
00168 };
00169 
00170 #endif
00171 

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)