![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /****************************************************************************** 00002 ** Copyright (c) 2005 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 ******************************************************************************/ 00005 /****************************************************************************** 00006 ** $RCSfile: polygon2D.h,v $ $Revision: 1.6 $ $State: Exp $ 00007 ******************************************************************************/ 00008 #ifndef polygon2D_H_ 00009 #define polygon2D_H_ 00010 00011 // 00012 // \file polygon2D.h 00013 // \brief This file contains all the classes related to the 2 dimensional 00014 // geometric polygon class. 00015 // 00016 00017 #include "geometry/geometryDefines.h" 00018 #include "geometry/point.h" 00019 #include "geometry/tdbextent.h" 00020 #include <vlutil/vlConfig.h> 00021 #include <vector> 00022 00023 // The DtPolygon2D class represents a 2 dimensional polygon 00024 class DT_DLL_geometry DtPolygon2D 00025 { 00026 public: 00027 00028 typedef std::vector<DtPoint> DtVertexContainer; 00029 typedef std::vector<DtPoint>::iterator DtVertexIter; 00030 typedef std::vector<DtPoint>::const_iterator DtVertexConstIter; 00031 00032 typedef DtChord DtEdge; 00033 00034 00035 DtPolygon2D(const DtVertexContainer& polygonVertices); 00036 DtPolygon2D(const DtExtent& extent); 00037 00038 virtual ~DtPolygon2D(); 00039 00040 private: 00041 // Copy constructor and Assignment operator not implemented 00042 DtPolygon2D(const DtPolygon2D& original); 00043 const DtPolygon2D& operator=(const DtPolygon2D& original); 00044 00045 public: 00046 00047 unsigned int numberOfVertices() const; 00048 00049 bool getVertex(DtPoint& vertex, unsigned int vertexIndex) const; 00050 DtPoint vertex(unsigned int vertexIndex) const; 00051 00052 bool setVertex(unsigned int vertexIndex, const DtPoint& newVertex); 00053 00054 DtVertexConstIter verticesBegin() const; 00055 DtVertexConstIter verticesEnd() const; 00056 00057 DtPoint verticesFront() const; 00058 DtPoint verticesBack() const; 00059 00060 unsigned int numberOfEdges() const; 00061 00062 DtEdge edge(unsigned int edgeIndex) const; 00063 bool getEdge(unsigned int edgeIndex, DtEdge& edgeToGet) const; 00064 00065 DtExtent extent() const; 00066 00067 const DtVertexContainer& vertices() const; 00068 00069 protected: 00070 bool testInvariant() const; 00071 00072 bool isValidVertexIndex(unsigned int vertexIndex) const; 00073 00074 bool isValidEdgeIndex(unsigned int edgeIndex) const; 00075 00076 private: 00077 DtVertexContainer myVertices; 00078 }; 00079 00080 00081 #endif 00082