OGRE  1.9.0
OgrePolygon.h
Go to the documentation of this file.
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4(Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2000-2014 Torus Knot Software Ltd
8Copyright (c) 2006 Matthias Fink, netAllied GmbH <matthias.fink@web.de>
9
10Permission is hereby granted, free of charge, to any person obtaining a copy
11of this software and associated documentation files (the "Software"), to deal
12in the Software without restriction, including without limitation the rights
13to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14copies of the Software, and to permit persons to whom the Software is
15furnished to do so, subject to the following conditions:
16
17The above copyright notice and this permission notice shall be included in
18all copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26THE 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
37namespace Ogre
38{
39
40
53 {
54
55 public:
57
59 typedef std::pair< Vector3, Vector3> Edge;
60
61 protected:
64 mutable bool mIsNormalSet;
67 void updateNormal(void) const;
68
69
70 public:
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
The class represents a polygon in 3D space.
Definition OgrePolygon.h:53
void setVertex(const Vector3 &vdata, size_t vertexIndex)
Sets a specific vertex of a polygon.
void deleteVertex(size_t vertex)
Deletes a specific vertex.
VertexList mVertexList
Definition OgrePolygon.h:62
Vector3 mNormal
Definition OgrePolygon.h:63
const Vector3 & getVertex(size_t vertex) const
Returns a vertex.
vector< Vector3 >::type VertexList
Definition OgrePolygon.h:56
const Vector3 & getNormal(void) const
Returns the polygon normal.
bool isPointInside(const Vector3 &point) const
Determines if a point is inside the polygon.
void storeEdges(EdgeMap *edgeMap) const
Stores the edges of the polygon in ccw order.
void removeDuplicates(void)
Removes duplicate vertices from a polygon.
multimap< Vector3, Vector3 >::type EdgeMap
Definition OgrePolygon.h:58
Polygon(const Polygon &cpy)
void insertVertex(const Vector3 &vdata, size_t vertexIndex)
Inserts a vertex at a specific position.
size_t getVertexCount(void) const
Vertex count.
void reset(void)
Resets the object.
void insertVertex(const Vector3 &vdata)
Inserts a vertex at the end of the polygon.
std::pair< Vector3, Vector3 > Edge
Definition OgrePolygon.h:59
void updateNormal(void) const
Updates the normal.
Standard 3-dimensional vector.
Definition OgreVector3.h:52
std::multimap< K, V, P, A > type
std::vector< T, A > type