OGRE  1.7
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator 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-2011 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 
35 
36 namespace Ogre
37 {
38 
39 
52  {
53 
54  public:
56 
58  typedef std::pair< Vector3, Vector3> Edge;
59 
60  protected:
62  mutable Vector3 mNormal;
63  mutable bool mIsNormalSet;
66  void updateNormal(void) const;
67 
68 
69  public:
70  Polygon();
71  ~Polygon();
72  Polygon( const Polygon& cpy );
73 
77  void insertVertex(const Vector3& vdata, size_t vertexIndex);
81  void insertVertex(const Vector3& vdata);
82 
85  const Vector3& getVertex(size_t vertex) const;
86 
90  void setVertex(const Vector3& vdata, size_t vertexIndex);
91 
94  void removeDuplicates(void);
95 
98  size_t getVertexCount(void) const;
99 
102  const Vector3& getNormal(void) const;
103 
106  void deleteVertex(size_t vertex);
107 
114  bool isPointInside(const Vector3& point) const;
115 
120  void storeEdges(EdgeMap *edgeMap) const;
121 
124  void reset(void);
125 
128  bool operator == (const Polygon& rhs) const;
129 
132  bool operator != (const Polygon& rhs) const
133  { return !( *this == rhs ); }
134 
137  _OgreExport friend std::ostream& operator<< ( std::ostream& strm, const Polygon& poly );
138 
139  };
143 }
144 
145 #endif
#define _OgreExport
Definition: OgrePlatform.h:203
std::multimap< K, V, P, A > type
bool mIsNormalSet
Definition: OgrePolygon.h:63
Vector3 mNormal
Definition: OgrePolygon.h:62
vector< Vector3 >::type VertexList
Definition: OgrePolygon.h:55
The class represents a polygon in 3D space.
Definition: OgrePolygon.h:51
VertexList mVertexList
Definition: OgrePolygon.h:61
multimap< Vector3, Vector3 >::type EdgeMap
Definition: OgrePolygon.h:57
Standard 3-dimensional vector.
Definition: OgreVector3.h:51
std::ostream & operator<<(std::ostream &o, const TRect< T > &r)
Definition: OgreCommon.h:610
std::pair< Vector3, Vector3 > Edge
Definition: OgrePolygon.h:58
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++)