4
CSGLib - Software Library for Constructive Solid Geometry
5
Copyright (C) 2003-2004 Laurence Bourn
7
This library is free software; you can redistribute it and/or
8
modify it under the terms of the GNU Library General Public
9
License as published by the Free Software Foundation; either
10
version 2 of the License, or (at your option) any later version.
12
This library is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
Library General Public License for more details.
17
You should have received a copy of the GNU Library General Public
18
License along with this library; if not, write to the Free
19
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21
Please send remarks, questions and bug reports to laurencebourn@hotmail.com
24
#include "CSG_IndexDefs.h"
27
#include "MT_Plane3.h"
28
#include "MT_Point3.h"
30
template <typename AVProp, typename AFProp> class PolygonBase
34
// The per vertex properties
35
typedef AVProp TVProp;
37
// The per face properties
38
typedef AFProp TFProp;
40
typedef std::vector<TVProp> TVPropList;
41
typedef TVPropList::iterator TVPropIt;
43
// Functions required by the CSG library
44
////////////////////////////////////////
46
PolygonBase():m_fProp(){}
48
const TVPropList& Verts() const { return m_verts;}
49
TVPropList& Verts() { return m_verts;}
51
int Size() const { return m_verts.size();}
53
int operator[](int i) const {return m_verts[i];}
55
const TVProp& VertexProps(int i) const { return m_verts[i];}
56
TVProp& VertexProps(int i) { return m_verts[i];}
58
void SetPlane(const MT_Plane3& plane) { m_plane = plane;}
60
const MT_Plane3& Plane() const { return m_plane;}
61
MT_Vector3 Normal() const { return m_plane.Normal();}
63
int & Classification() { return m_classification;}
64
const int& Classification() const { return m_classification;}
66
// Reverse this polygon.
69
std::reverse(m_verts.begin(),m_verts.end());
76
TFProp& FProp(){ return m_fProp;}
77
const TFProp& FProp() const { return m_fProp;}
88
// gross waste of bits! 1 = in, 2 = out;
b'\\ No newline at end of file'