OgrePolygon.h
Go to the documentation of this file.
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-2013 Torus Knot Software Ltd
00008 Copyright (c) 2006 Matthias Fink, netAllied GmbH <matthias.fink@web.de>                             
00009 
00010 Permission is hereby granted, free of charge, to any person obtaining a copy
00011 of this software and associated documentation files (the "Software"), to deal
00012 in the Software without restriction, including without limitation the rights
00013 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00014 copies of the Software, and to permit persons to whom the Software is
00015 furnished to do so, subject to the following conditions:
00016 
00017 The above copyright notice and this permission notice shall be included in
00018 all copies or substantial portions of the Software.
00019 
00020 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00021 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00022 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00023 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00024 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00025 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00026 THE SOFTWARE.
00027 -----------------------------------------------------------------------------
00028 */
00029 #ifndef __Polygon_H__
00030 #define __Polygon_H__
00031 
00032 #include "OgrePrerequisites.h"
00033 #include "OgreVector3.h"
00034 #include "OgreHeaderPrefix.h"
00035 
00036 
00037 namespace Ogre
00038 {
00039 
00040 
00052     class _OgreExport Polygon
00053     {
00054 
00055     public:
00056         typedef vector<Vector3>::type               VertexList;
00057 
00058         typedef multimap<Vector3, Vector3>::type        EdgeMap;
00059         typedef std::pair< Vector3, Vector3>        Edge;
00060 
00061     protected:
00062         VertexList      mVertexList;
00063         mutable Vector3 mNormal;
00064         mutable bool    mIsNormalSet;
00067         void updateNormal(void) const;
00068 
00069 
00070     public:
00071         Polygon();
00072         ~Polygon();
00073         Polygon( const Polygon& cpy );
00074 
00078         void insertVertex(const Vector3& vdata, size_t vertexIndex);
00082         void insertVertex(const Vector3& vdata);
00083 
00086         const Vector3& getVertex(size_t vertex) const;
00087 
00091         void setVertex(const Vector3& vdata, size_t vertexIndex);
00092 
00095         void removeDuplicates(void);
00096 
00099         size_t getVertexCount(void) const;
00100 
00103         const Vector3& getNormal(void) const;
00104 
00107         void deleteVertex(size_t vertex);
00108 
00115         bool isPointInside(const Vector3& point) const;
00116 
00121         void storeEdges(EdgeMap *edgeMap) const;
00122 
00125         void reset(void);
00126 
00129         bool operator == (const Polygon& rhs) const;
00130 
00133         bool operator != (const Polygon& rhs) const
00134         { return !( *this == rhs ); }
00135 
00138         _OgreExport friend std::ostream& operator<< ( std::ostream& strm, const Polygon& poly );
00139 
00140     };
00144 }
00145 
00146 #include "OgreHeaderSuffix.h"
00147 
00148 #endif

Copyright © 2012 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Mon Jul 27 2020 13:40:44