OGRE  1.9
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
OgrePolygon.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4 (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org/
6 
7 Copyright (c) 2000-2014 Torus Knot Software Ltd
8 Copyright (c) 2006 Matthias Fink, netAllied GmbH <matthias.fink@web.de>
9 
10 Permission is hereby granted, free of charge, to any person obtaining a copy
11 of this software and associated documentation files (the "Software"), to deal
12 in the Software without restriction, including without limitation the rights
13 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14 copies of the Software, and to permit persons to whom the Software is
15 furnished to do so, subject to the following conditions:
16 
17 The above copyright notice and this permission notice shall be included in
18 all copies or substantial portions of the Software.
19 
20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26 THE SOFTWARE.
27 -----------------------------------------------------------------------------
28 */
29 #ifndef __Polygon_H__
30 #define __Polygon_H__
31 
32 #include "OgrePrerequisites.h"
33 #include "OgreVector3.h"
34 #include "OgreHeaderPrefix.h"
35 
36 
37 namespace Ogre
38 {
39 
40 
53  {
54 
55  public:
57 
59  typedef std::pair< Vector3, Vector3> Edge;
60 
61  protected:
63  mutable Vector3 mNormal;
64  mutable bool mIsNormalSet;
67  void updateNormal(void) const;
68 
69 
70  public:
71  Polygon();
72  ~Polygon();
73  Polygon( const Polygon& cpy );
74 
78  void insertVertex(const Vector3& vdata, size_t vertexIndex);
82  void insertVertex(const Vector3& vdata);
83 
86  const Vector3& getVertex(size_t vertex) const;
87 
91  void setVertex(const Vector3& vdata, size_t vertexIndex);
92 
95  void removeDuplicates(void);
96 
99  size_t getVertexCount(void) const;
100 
103  const Vector3& getNormal(void) const;
104 
107  void deleteVertex(size_t vertex);
108 
115  bool isPointInside(const Vector3& point) const;
116 
121  void storeEdges(EdgeMap *edgeMap) const;
122 
125  void reset(void);
126 
129  bool operator == (const Polygon& rhs) const;
130 
133  bool operator != (const Polygon& rhs) const
134  { return !( *this == rhs ); }
135 
138  _OgreExport friend std::ostream& operator<< ( std::ostream& strm, const Polygon& poly );
139 
140  };
144 }
145 
146 #include "OgreHeaderSuffix.h"
147 
148 #endif
#define _OgreExport
Definition: OgrePlatform.h:260
std::multimap< K, V, P, A > type
bool mIsNormalSet
Definition: OgrePolygon.h:64
Vector3 mNormal
Definition: OgrePolygon.h:63
vector< Vector3 >::type VertexList
Definition: OgrePolygon.h:56
The class represents a polygon in 3D space.
Definition: OgrePolygon.h:52
VertexList mVertexList
Definition: OgrePolygon.h:62
multimap< Vector3, Vector3 >::type EdgeMap
Definition: OgrePolygon.h:58
Standard 3-dimensional vector.
Definition: OgreVector3.h:51
std::ostream & operator<<(std::ostream &o, const TRect< T > &r)
Definition: OgreCommon.h:636
std::pair< Vector3, Vector3 > Edge
Definition: OgrePolygon.h:59
void removeDuplicates(C &c)
bool operator==(STLAllocator< T, P > const &, STLAllocator< T2, P > const &)
determine equality, can memory from another allocator be released by this allocator, (ISO C++)
bool operator!=(STLAllocator< T, P > const &, STLAllocator< T2, P > const &)
determine equality, can memory from another allocator be released by this allocator, (ISO C++)