24 class gsSolidHalfFace :
public gsSolidElement<T>
27 typedef gsSolidElement<T> SolidElement;
29 typedef typename gsSolidElement<T>::gsSolidHeVertexHandle gsSolidHeVertexHandle;
30 typedef typename gsSolidElement<T>::gsSolidHalfEdgeHandle gsSolidHalfEdgeHandle;
31 typedef typename gsSolidElement<T>::gsSolidHalfFaceHandle gsSolidHalfFaceHandle;
32 typedef typename gsSolidElement<T>::gsVolumeHandle gsVolumeHandle;
36 gsSolidHalfFaceHandle mate;
39 std::vector<gsSolidHalfEdgeHandle > loop;
40 gsTrimSurface<T> * surf;
43 gsSolidHalfFace() : SolidElement() { vol = 0; }
45 explicit gsSolidHalfFace(
int i) : SolidElement(i) { vol = 0; }
47 virtual ~gsSolidHalfFace() {
delete surf; }
50 void setBoundary(std::vector<gsSolidHalfEdgeHandle>
const & hedges);
56 int loopN()
const {
return loop.size();}
59 virtual std::ostream &print(std::ostream &os)
const;
62 std::vector<gsSolidHeVertexHandle> getVertices()
const;
65 std::vector<gsSolidHalfEdgeHandle> getHalfEdges()
const;
67 gsSolidHalfEdgeHandle getHalfEdgeFromLoopOrder(
unsigned loopNumber,
int curveNumber)
const
69 gsSolidHalfEdgeHandle he=*(loop.begin()+loopNumber);
70 for (
int i=0; i != surf->domain().loop(loopNumber).size(); ++i)
72 if (i==curveNumber)
break;
78 gsSolidHalfEdgeHandle getHalfEdgeFromBoundaryOrder(
unsigned curveNumber)
const {
return getHalfEdgeFromLoopOrder(0, curveNumber);}
80 unsigned nCurvesOfOneLoop(
unsigned loopNumber) {
return surf->domain().loop(loopNumber).curves().size(); }
83 int indexOfEdge(gsSolidHalfEdgeHandle e)
const;
86 int indexOfVertex(gsSolidHeVertexHandle v)
const;
89 bool containsVertex(
const gsSolidHeVertexHandle v)
const;
97 std::ostream &operator<<(std::ostream &os, const gsSolidHalfFace<T>& obj)
98 {
return obj.print(os); }
101 void gsSolidHalfFace<T>::setBoundary(std::vector<gsSolidHalfEdgeHandle>
const & hedges)
103 typename std::vector<gsSolidHalfEdgeHandle>::const_iterator p = hedges.begin();
105 (*p)->prev = hedges.back();
107 for (
typename std::vector<gsSolidHalfEdgeHandle>::const_iterator
108 it = hedges.begin()+1; it!= hedges.end(); ++it)
115 (*p)->next = hedges.front();
119 std::ostream &gsSolidHalfFace<T>::print(std::ostream &os)
const
121 os<<
"\nHalf face ID = "<< this->getId() <<
" with ";
122 os<<
"Coordinates of vertices of face 0: \n";
123 std::vector<gsSolidHeVertexHandle> fvert = getVertices();
124 for (
typename std::vector<gsSolidHeVertexHandle>::const_iterator it=fvert.begin();it!=fvert.end();++it) os<<**it;
130 std::vector<typename gsSolidHalfFace<T>::gsSolidHeVertexHandle> gsSolidHalfFace<T>::getVertices()
const
132 std::vector<gsSolidHeVertexHandle> vert;
133 gsSolidHalfEdgeHandle edge1 = loop[0];
134 vert.push_back(edge1->source);
135 gsSolidHalfEdgeHandle current_edge=edge1->next;
136 while ( current_edge != edge1 )
138 vert.push_back(current_edge->source);
139 current_edge=current_edge->next;
145 std::vector< typename gsSolidHalfFace<T>::gsSolidHalfEdgeHandle > gsSolidHalfFace<T>::getHalfEdges()
const
147 std::vector<gsSolidHalfEdgeHandle> HEs;
148 gsSolidHalfEdgeHandle edge1 = loop[0];
149 HEs.push_back(edge1);
150 gsSolidHalfEdgeHandle current_edge=edge1->next;
151 while ( current_edge != edge1 )
153 HEs.push_back(current_edge);
154 current_edge=current_edge->next;
160 int gsSolidHalfFace<T>::indexOfEdge(gsSolidHalfEdgeHandle e)
const
163 gsSolidHalfEdgeHandle tempEdge = this->loop[0];
166 tempEdge = tempEdge->next;
168 assert(tempEdge != this->loop[0]);
174 int gsSolidHalfFace<T>::indexOfVertex(gsSolidHeVertexHandle v)
const
177 gsSolidHalfEdgeHandle tempEdge = this->loop[0];
178 while(tempEdge->source != v)
180 tempEdge = tempEdge->next;
182 assert(tempEdge != this->loop[0]);
188 bool gsSolidHalfFace<T>::containsVertex(
const gsSolidHeVertexHandle v)
const
190 gsSolidHalfEdgeHandle tempEdge = this->loop[0];
193 tempEdge = tempEdge->next;
194 if (tempEdge->source == v) {
return true; };
195 }
while (tempEdge != this->loop[0]);
Provides gsSolidElement class - interface for an element (vertex, edge or face) of a solid...