~ubuntu-branches/ubuntu/intrepid/blender/intrepid-updates

« back to all changes in this revision

Viewing changes to intern/csg/intern/CSG_Polygon.h

  • Committer: Bazaar Package Importer
  • Author(s): Cyril Brulebois
  • Date: 2008-08-08 02:45:40 UTC
  • mfrom: (12.1.14 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080808024540-kkjp7ekfivzhuw3l
Tags: 2.46+dfsg-4
* Fix python syntax warning in import_dxf.py, which led to nasty output
  in installation/upgrade logs during byte-compilation, using a patch
  provided by the script author (Closes: #492280):
   - debian/patches/45_fix_python_syntax_warning

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#ifndef __POLYGON_H
2
 
#define __POLYGON_H
3
 
/*
4
 
  CSGLib - Software Library for Constructive Solid Geometry
5
 
  Copyright (C) 2003-2004  Laurence Bourn
6
 
 
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.
11
 
 
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.
16
 
 
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.
20
 
 
21
 
  Please send remarks, questions and bug reports to laurencebourn@hotmail.com
22
 
*/
23
 
 
24
 
#include "CSG_IndexDefs.h"
25
 
 
26
 
#include <algorithm>
27
 
#include "MT_Plane3.h"
28
 
#include "MT_Point3.h"
29
 
 
30
 
template <typename AVProp, typename AFProp> class PolygonBase
31
 
{
32
 
public :
33
 
 
34
 
        // The per vertex properties
35
 
        typedef AVProp TVProp;
36
 
 
37
 
        // The per face properties
38
 
        typedef AFProp TFProp;
39
 
 
40
 
        typedef std::vector<TVProp> TVPropList;
41
 
        typedef TVPropList::iterator TVPropIt;
42
 
 
43
 
        // Functions required by the CSG library
44
 
        ////////////////////////////////////////
45
 
 
46
 
        PolygonBase():m_fProp(){}
47
 
 
48
 
        const TVPropList& Verts() const { return m_verts;}
49
 
        TVPropList& Verts() { return m_verts;}
50
 
 
51
 
        int Size() const { return m_verts.size();}
52
 
 
53
 
        int operator[](int i) const {return m_verts[i];}
54
 
 
55
 
        const TVProp& VertexProps(int i) const { return m_verts[i];}
56
 
        TVProp& VertexProps(int i) { return m_verts[i];}
57
 
 
58
 
        void SetPlane(const MT_Plane3& plane) { m_plane = plane;}
59
 
 
60
 
        const MT_Plane3& Plane() const { return m_plane;}
61
 
        MT_Vector3 Normal() const { return m_plane.Normal();}
62
 
 
63
 
        int & Classification() { return m_classification;}
64
 
        const int& Classification() const { return m_classification;}
65
 
 
66
 
        // Reverse this polygon.
67
 
        void Reverse() 
68
 
        {
69
 
                std::reverse(m_verts.begin(),m_verts.end());
70
 
                m_plane.Invert();
71
 
        }
72
 
 
73
 
        // Our functions
74
 
        ////////////////
75
 
 
76
 
        TFProp& FProp(){ return m_fProp;}
77
 
        const TFProp& FProp() const { return m_fProp;}
78
 
 
79
 
        ~PolygonBase() {}
80
 
                
81
 
private :
82
 
 
83
 
        TVPropList m_verts;
84
 
        MT_Plane3 m_plane;
85
 
 
86
 
        TFProp m_fProp;
87
 
 
88
 
        // gross waste of bits! 1 = in, 2 = out;
89
 
        int m_classification;
90
 
 
91
 
};      
92
 
 
93
 
#endif
 
 
b'\\ No newline at end of file'