30 #include "PatchTools.H"
44 const pointField& sFeatLocalPts(surf.localPoints());
45 const edgeList& sFeatEds(surf.edges());
46 const labelListList edgeFaces = PatchTools::sortedEdgeFaces(surf);
47 const vectorField& faceNormals = surf.faceNormals();
48 const labelListList pointEdges = PatchTools::sortedPointEdges(surf);
69 forAll(featurePointFeatureEdges, pI)
71 featurePointFeatureEdges[pI] = pointEdges[featurePoints[pI]];
77 labelList pointMap(sFeatLocalPts.size(), -1);
91 label sFPI = featurePoints[i];
93 tmpPts.
append(sFeatLocalPts[sFPI]);
95 pointMap[sFPI] = tmpPts.size() - 1;
99 nonFeatureStart_ = tmpPts.size();
105 label sFEI = featureEdges[i];
109 const edge& fE = sFeatEds[sFEI];
111 edgeDirections[i] = fE.
vec(sFeatLocalPts);
114 if (pointMap[fE.
start()] == -1)
118 pointMap[fE.
start()] = tmpPts.size() - 1;
121 eds[i].start() = pointMap[fE.
start()];
123 if (pointMap[fE.
end()] == -1)
127 pointMap[fE.
end()] = tmpPts.size() - 1;
130 eds[i].end() = pointMap[fE.
end()];
133 const labelList& eFaces = edgeFaces[sFEI];
140 label eFI = eFaces[j];
145 norms.
append(faceNormals[eFI]);
147 faceMap[eFI] = norms.size() - 1;
150 edgeNormals[i][j] =
faceMap[eFI];
152 const vector cross = (faceNormals[eFI] ^ edgeDirections[i]);
154 surf[eFI].
centre(surf.points())
155 - sFeatLocalPts[fE.
start()];
157 normalDirections[i][j] =
161 & (fC0tofE0/(
mag(fC0tofE0)+ VSMALL))
169 vector fC0tofC1(vector::zero);
171 if (eFaces.
size() == 2)
174 surf[eFaces[1]].
centre(surf.points())
175 - surf[eFaces[0]].
centre(surf.points());
178 edStatus[i] = classifyEdge(norms, edgeNormals[i], fC0tofC1);
180 if (isRegionFeatureEdge[i])
189 forAll(featurePointFeatureEdges, pI)
191 const labelList& fpfe = featurePointFeatureEdges[pI];
197 const label oldEdgeIndex = fpfe[eI];
199 const label newFeatureEdgeIndex = edgeMap[oldEdgeIndex];
201 if (newFeatureEdgeIndex != -1)
203 newFeatureEdges.
append(newFeatureEdgeIndex);
207 featurePointFeatureEdges[pI].
transfer(newFeatureEdges);
223 if (eStat == EXTERNAL)
227 else if (eStat == INTERNAL)
231 else if (eStat == FLAT)
235 else if (eStat == OPEN)
239 else if (eStat == MULTIPLE)
243 else if (eStat == NONE)
246 <<
nl <<
"classifyEdge returned NONE on edge "
248 <<
". There is a problem with definition of this edge."
253 internalStart_ = externalEds.size();
254 flatStart_ = internalStart_ + internalEds.size();
255 openStart_ = flatStart_ + flatEds.size();
256 multipleStart_ = openStart_ + openEds.size();
260 ListListOps::combine<labelList>
276 forAll(featurePointFeatureEdges, pI)
284 edgeMesh::operator=(
edgeMesh(pts, eds));
287 edgeDirections_ = edgeDirections/(
mag(edgeDirections) + VSMALL);
288 edgeNormals_ = edgeNormals;
289 normalDirections_ = normalDirections;
290 regionEdges_ = regionEdges;
304 for (
label i = 0; i < nonFeatureStart_; i++)
308 if (ptStatus == CONVEX)
312 else if (ptStatus == CONCAVE)
316 else if (ptStatus == MIXED)
320 else if (ptStatus == NONFEATURE)
323 <<
nl <<
"classifyFeaturePoint returned NONFEATURE on point at "
325 <<
". There is a problem with definition of this feature point."
330 concaveStart_ = convexPts.size();
331 mixedStart_ = concaveStart_ + concavePts.size();
335 ListListOps::combine<labelList>
351 ptMap[i] = ftPtMap[i];
370 for (
label i = 0; i < nonFeatureStart_; i++)
374 const labelList& ptEds = edgeMesh::pointEdges()[i];
378 const labelList& ptEdNorms(edgeNormals[ptEds[j]]);
382 if (
findIndex(tmpFtPtNorms, ptEdNorms[
k]) == -1)
384 bool addNormal =
true;
391 (normals_[ptEdNorms[
k]] & normals_[tmpFtPtNorms[q]])
404 tmpFtPtNorms.
append(ptEdNorms[
k]);
410 featurePointNormals[i] = tmpFtPtNorms;
413 featurePointNormals_ = featurePointNormals;
414 featurePointEdges_ = featurePointFeatureEdges;