changed: gcc8 base update
[opensg.git] / Source / System / NodeCores / Drawables / Nurbs / Internal / OSGDCTPFace.inl
blob98d7bcead7e2ff2974f713642ac427a9546959b6
1 /*---------------------------------------------------------------------------*\
2  *                           OpenSG NURBS Library                            *
3  *                                                                           *
4  *                                                                           *
5  * Copyright (C) 2001-2006 by the University of Bonn, Computer Graphics Group*
6  *                                                                           *
7  *                         http://cg.cs.uni-bonn.de/                         *
8  *                                                                           *
9  * contact: edhellon@cs.uni-bonn.de, guthe@cs.uni-bonn.de, rk@cs.uni-bonn.de *
10  *                                                                           *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
13  *                                License                                    *
14  *                                                                           *
15  * This library is free software; you can redistribute it and/or modify it   *
16  * under the terms of the GNU Library General Public License as published    *
17  * by the Free Software Foundation, version 2.                               *
18  *                                                                           *
19  * This library is distributed in the hope that it will be useful, but       *
20  * WITHOUT ANY WARRANTY; without even the implied warranty of                *
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
22  * Library General Public License for more details.                          *
23  *                                                                           *
24  * You should have received a copy of the GNU Library General Public         *
25  * License along with this library; if not, write to the Free Software       *
26  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
27  *                                                                           *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
30  *                                Changes                                    *
31  *                                                                           *
32  *                                                                           *
33  *                                                                           *
34  *                                                                           *
35  *                                                                           *
36  *                                                                           *
37 \*---------------------------------------------------------------------------*/
39 OSG_BEGIN_NAMESPACE
41 inline TrimSegment::TrimSegment(void) :
42     trimbeziers(),
43     start      (NULL),
44     end        (NULL)
46     // nothing to do
49 inline TrimSegment::TrimSegment(const TrimSegment &ts) :
50     trimbeziers(ts.trimbeziers),
51     start      (ts.start      ),
52     end        (ts.end        )
54     // nothing to do
57 inline TrimSegment::~TrimSegment(void)
59     // nothing to do
63 inline DCTPFace::DCTPFace(void) :
64     vertices     (),
65     edges        (),
66 #ifdef OSG_UNION_TRI_QUAD
67     orig_face    (),
68 #else
69     orig_triangle(),
70     orig_quad    (),
71 #endif
72     norm         (),
73     id           (),
74     trimseg      (),
75     faceinfo     ()
77     // nothing to do
80 inline DCTPFace::~DCTPFace(void)
82     // nothing to do
85 inline void DCTPFace::AddVertex(DCTPVertex *v)
87     //FIXME: check for adding existing vertex?
88     vertices.push_back(v);
91 inline void DCTPFace::RemoveVertex(DCTPVertex *v)
93     std::vector<DCTPVertex*> ::iterator ve      = vertices.end();
94     bool                                removed = false;
96     for(std::vector<DCTPVertex*>::iterator i = vertices.begin(); i != ve; ++i)
97     {
98         if(*i == v)
99         {
100             removed = true;
101             vertices.erase(i);
102             break;
103         }
104     }
106     if(!removed)
107         std::cerr << "DCTPFace::RemoveVertex: trying to remove nonexistant vertex..." << std::endl;
110 //to keep the order of the vertices
111 inline void DCTPFace::ReplaceVertex(DCTPVertex *oldv, DCTPVertex *newv)
113     std::vector<DCTPVertex*> ::iterator ve       = vertices.end();
114     bool                                replaced = false;
116     for(std::vector<DCTPVertex*>::iterator i = vertices.begin(); i != ve; ++i)
117     {
118         if(*i == oldv)
119         {
120             replaced = true;
121             *i       = newv;
122             break;
123         }
124     }
126     if(!replaced)
127         std::cerr << "DCTPFace::ReplaceVertex: trying to replace nonexistant vertex..." << std::endl;
130 inline void DCTPFace::AddEdge(DCTPEdge *e)
132     //FIXME: check for adding existing edge?
133     edges.push_back(e);
136 inline void DCTPFace::RemoveEdge(DCTPEdge *e)
138     std::vector<DCTPEdge*> ::iterator ee      = edges.end();
139     bool                              removed = false;
141     for(std::vector<DCTPEdge*>::iterator i = edges.begin(); i != ee; ++i)
142     {
143         if(*i == e)
144         {
145             removed = true;
146             edges.erase(i);
147             break;
148         }
149     }
151     if(!removed)
152         std::cerr << "DCTPFace::RemoveEdge: trying to remove nonexistant edge..." << std::endl;
155 inline void DCTPFace::dump_triangle(void)
157 #ifdef OSG_UNION_TRI_QUAD
158 //FIXME: operator<< deprecated
159 //      std::cerr << orig_face[ 0 ]->coords << ' ' << orig_face[ 1 ]->coords << ' ' << orig_face[ 2 ]->coords;
160 //    if( orig_face[ 3 ] ) std::cerr << ' ' << orig_face[ 3 ]->coords;
161     std::cerr << std::endl;
162 #else
163     if(orig_triangle[0])
164 //        std::cerr << orig_triangle[ 0 ]->coords << ' ' << orig_triangle[ 1 ]->coords
165 //             << ' ' << orig_triangle[ 2 ]->coords << std::endl;
166         else
167 //        std::cerr << orig_quad[ 0 ]->coords << " " << orig_quad[ 1 ]->coords << " "
168 //             << orig_quad[ 2 ]->coords << " " << orig_quad[ 3 ]->coords << std::endl;
169 #endif
172 OSG_END_NAMESPACE