00001 /* 00002 ----------------------------------------------------------------------------- 00003 This source file is part of OGRE 00004 (Object-oriented Graphics Rendering Engine) 00005 For the latest info, see http://www.ogre3d.org/ 00006 00007 Copyright (c) 2000-2006 Torus Knot Software Ltd 00008 Copyright (c) 2006 Matthias Fink, netAllied GmbH <matthias.fink@web.de> 00009 Also see acknowledgements in Readme.html 00010 00011 This program is free software; you can redistribute it and/or modify it under 00012 the terms of the GNU Lesser General Public License as published by the Free Software 00013 Foundation; either version 2 of the License, or (at your option) any later 00014 version. 00015 00016 This program is distributed in the hope that it will be useful, but WITHOUT 00017 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00018 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. 00019 00020 You should have received a copy of the GNU Lesser General Public License along with 00021 this program; if not, write to the Free Software Foundation, Inc., 59 Temple 00022 Place - Suite 330, Boston, MA 02111-1307, USA, or go to 00023 http://www.gnu.org/copyleft/lesser.txt. 00024 00025 You may alternatively use this source under the terms of a specific version of 00026 the OGRE Unrestricted License provided you have obtained such a license from 00027 Torus Knot Software Ltd. 00028 ----------------------------------------------------------------------------- 00029 */ 00030 #ifndef __Polygon_H__ 00031 #define __Polygon_H__ 00032 00033 #include "OgrePrerequisites.h" 00034 #include "OgreVector3.h" 00035 00036 00037 namespace Ogre 00038 { 00039 00040 00046 class _OgreExport Polygon 00047 { 00048 00049 public: 00050 typedef std::vector<Vector3> VertexList; 00051 00052 typedef std::multimap<Vector3, Vector3> EdgeMap; 00053 typedef std::pair< Vector3, Vector3> Edge; 00054 00055 protected: 00056 VertexList mVertexList; 00057 mutable Vector3 mNormal; 00058 mutable bool mIsNormalSet; 00061 void updateNormal(void) const; 00062 00063 00064 public: 00065 Polygon(); 00066 ~Polygon(); 00067 Polygon( const Polygon& cpy ); 00068 00072 void insertVertex(const Vector3& vdata, size_t vertexIndex); 00076 void insertVertex(const Vector3& vdata); 00077 00080 const Vector3& getVertex(size_t vertex) const; 00081 00085 void setVertex(const Vector3& vdata, size_t vertexIndex); 00086 00089 void removeDuplicates(void); 00090 00093 size_t getVertexCount(void) const; 00094 00097 const Vector3& getNormal(void) const; 00098 00101 void deleteVertex(size_t vertex); 00102 00109 bool isPointInside(const Vector3& point) const; 00110 00115 void storeEdges(EdgeMap *edgeMap) const; 00116 00119 void reset(void); 00120 00123 bool operator == (const Polygon& rhs) const; 00124 00127 bool operator != (const Polygon& rhs) const 00128 { return !( *this == rhs ); } 00129 00132 _OgreExport friend std::ostream& operator<< ( std::ostream& strm, const Polygon& poly ); 00133 00134 }; 00135 00136 } 00137 00138 #endif
Copyright © 2008 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Sep 27 22:02:24 2009