本文整理汇总了C++中triSurface::localPoints方法的典型用法代码示例。如果您正苦于以下问题:C++ triSurface::localPoints方法的具体用法?C++ triSurface::localPoints怎么用?C++ triSurface::localPoints使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类triSurface
的用法示例。
在下文中一共展示了triSurface::localPoints方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dir
// Dump collapse region to .obj file
static void writeRegionOBJ
(
const triSurface& surf,
const label regionI,
const labelList& collapseRegion,
const labelList& outsideVerts
)
{
fileName dir("regions");
mkDir(dir);
fileName regionName(dir / "region_" + name(regionI) + ".obj");
Pout<< "Dumping region " << regionI << " to file " << regionName << endl;
boolList include(surf.size(), false);
forAll(collapseRegion, faceI)
{
if (collapseRegion[faceI] == regionI)
{
include[faceI] = true;
}
}
labelList pointMap, faceMap;
triSurface regionSurf(surf.subsetMesh(include, pointMap, faceMap));
Pout<< "Region " << regionI << " surface:" << nl;
regionSurf.writeStats(Pout);
regionSurf.write(regionName);
// Dump corresponding outside vertices.
fileName pointsName(dir / "regionPoints_" + name(regionI) + ".obj");
Pout<< "Dumping region " << regionI << " points to file " << pointsName
<< endl;
OFstream str(pointsName);
forAll(outsideVerts, i)
{
meshTools::writeOBJ(str, surf.localPoints()[outsideVerts[i]]);
}
示例2: bb
void Foam::edgeIntersections::checkEdges(const triSurface& surf)
{
const pointField& localPoints = surf.localPoints();
const edgeList& edges = surf.edges();
const labelListList& edgeFaces = surf.edgeFaces();
treeBoundBox bb(localPoints);
scalar minSize = SMALL * bb.minDim();
forAll(edges, edgeI)
{
const edge& e = edges[edgeI];
scalar eMag = e.mag(localPoints);
if (eMag < minSize)
{
WarningIn
(
"Foam::edgeIntersections::checkEdges(const triSurface& surf)"
) << "Edge " << edgeI << " vertices " << e
<< " coords:" << localPoints[e[0]] << ' '
<< localPoints[e[1]] << " is very small compared to bounding"
<< " box dimensions " << bb << endl
<< "This might lead to problems in intersection"
<< endl;
}
if (edgeFaces[edgeI].size() == 1)
{
WarningIn
(
"Foam::edgeIntersections::checkEdges(const triSurface& surf)"
) << "Edge " << edgeI << " vertices " << e
<< " coords:" << localPoints[e[0]] << ' '
<< localPoints[e[1]] << " has only one face connected to it:"
<< edgeFaces[edgeI] << endl
<< "This might lead to problems in intersection"
<< endl;
}
}
}
示例3: collapseEdge
// Collapses small edge to point, thus removing triangle.
label collapseEdge(triSurface& surf, const scalar minLen)
{
label nTotalCollapsed = 0;
while (true)
{
const pointField& localPoints = surf.localPoints();
const List<labelledTri>& localFaces = surf.localFaces();
// Mapping from old to new points
labelList pointMap(surf.nPoints());
forAll(pointMap, i)
{
pointMap[i] = i;
}
// Storage for new points.
pointField newPoints(localPoints);
// To protect neighbours of collapsed faces.
boolList okToCollapse(surf.size(), true);
label nCollapsed = 0;
forAll(localFaces, faceI)
{
if (okToCollapse[faceI])
{
// Check edge lengths.
const triSurface::FaceType& f = localFaces[faceI];
forAll(f, fp)
{
label v = f[fp];
label v1 = f[f.fcIndex(fp)];
if (mag(localPoints[v1] - localPoints[v]) < minLen)
{
// Collapse f[fp1] onto f[fp].
pointMap[v1] = v;
newPoints[v] = 0.5*(localPoints[v1] + localPoints[v]);
Pout<< "Collapsing triange " << faceI << " to edge mid "
<< newPoints[v] << endl;
nCollapsed++;
okToCollapse[faceI] = false;
// Protect point neighbours from collapsing.
markPointNbrs(surf, faceI, false, okToCollapse);
break;
}
}
}
}
Pout<< "collapseEdge : collapsing " << nCollapsed << " triangles"
<< endl;
nTotalCollapsed += nCollapsed;
if (nCollapsed == 0)
{
break;
}
// Pack the triangles
surf = pack(surf, newPoints, pointMap);
}