OGRE: OgrePolygon.h Source File - OGRE Documentation

# 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-2009 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
    00035
    00036 namespace Ogre
    00037 {
    00038
    00039
    00051     class _OgreExport Polygon
    00052     {
    00053
    00054     public:
    00055         typedef vector<Vector3>::type               VertexList;
    00056
    00057         typedef multimap<Vector3, Vector3>::type        EdgeMap;
    00058         typedef std::pair< Vector3, Vector3>        Edge;
    00059
    00060     protected:
    00061         VertexList      mVertexList;
    00062         mutable Vector3 mNormal;
    00063         mutable bool    mIsNormalSet;
    00066         void updateNormal(void) const;
    00067
    00068
    00069     public:
    00070         Polygon();
    00071         ~Polygon();
    00072         Polygon( const Polygon& cpy );
    00073
    00077         void insertVertex(const Vector3& vdata, size_t vertexIndex);
    00081         void insertVertex(const Vector3& vdata);
    00082
    00085         const Vector3& getVertex(size_t vertex) const;
    00086
    00090         void setVertex(const Vector3& vdata, size_t vertexIndex);
    00091
    00094         void removeDuplicates(void);
    00095
    00098         size_t getVertexCount(void) const;
    00099
    00102         const Vector3& getNormal(void) const;
    00103
    00106         void deleteVertex(size_t vertex);
    00107
    00114         bool isPointInside(const Vector3& point) const;
    00115
    00120         void storeEdges(EdgeMap *edgeMap) const;
    00121
    00124         void reset(void);
    00125
    00128         bool operator == (const Polygon& rhs) const;
    00129
    00132         bool operator != (const Polygon& rhs) const
    00133         { return !( *this == rhs ); }
    00134
    00137         _OgreExport friend std::ostream& operator<< ( std::ostream& strm, const Polygon& poly );
    00138
    00139     };
    00143 }
    00144
    00145 #endif

Copyright © 2008 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Wed Nov 3 2010 19:24:52