本文整理汇总了C++中triSurface::nEdges方法的典型用法代码示例。如果您正苦于以下问题:C++ triSurface::nEdges方法的具体用法?C++ triSurface::nEdges怎么用?C++ triSurface::nEdges使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类triSurface
的用法示例。
在下文中一共展示了triSurface::nEdges方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: start
// Update intersections for selected edges.
void Foam::edgeIntersections::intersectEdges
(
const triSurface& surf1,
const pointField& points1, // surf1 meshPoints (not localPoints!)
const triSurfaceSearch& querySurf2,
const scalarField& surf1PointTol, // surf1 tolerance per point
const labelList& edgeLabels
)
{
const triSurface& surf2 = querySurf2.surface();
const vectorField& normals2 = surf2.faceNormals();
const labelList& meshPoints = surf1.meshPoints();
if (debug)
{
Pout<< "Calculating intersection of " << edgeLabels.size() << " edges"
<< " out of " << surf1.nEdges() << " with " << surf2.size()
<< " triangles ..." << endl;
}
pointField start(edgeLabels.size());
pointField end(edgeLabels.size());
vectorField edgeDirs(edgeLabels.size());
// Go through all edges, calculate intersections
forAll(edgeLabels, i)
{
label edgeI = edgeLabels[i];
if (debug)// && (i % 1000 == 0))
{
Pout<< "Intersecting edge " << edgeI << " with surface" << endl;
}
const edge& e = surf1.edges()[edgeI];
const point& pStart = points1[meshPoints[e.start()]];
const point& pEnd = points1[meshPoints[e.end()]];
const vector eVec(pEnd - pStart);
const vector n(eVec/(mag(eVec) + VSMALL));
// Start tracking somewhat before pStart and up to somewhat after p1.
// Note that tolerances here are smaller than those used to classify
// hit below.
// This will cause this hit to be marked as degenerate and resolved
// later on.
start[i] = pStart - 0.5*surf1PointTol[e[0]]*n;
end[i] = pEnd + 0.5*surf1PointTol[e[1]]*n;
edgeDirs[i] = n;
}
示例2: eVec
// Update intersections for selected edges.
void Foam::edgeIntersections::intersectEdges
(
const triSurface& surf1,
const pointField& points1, // surf1 meshPoints (not localPoints!)
const triSurfaceSearch& querySurf2,
const scalarField& surf1PointTol, // surf1 tolerance per point
const labelList& edgeLabels
)
{
const triSurface& surf2 = querySurf2.surface();
const vectorField& normals2 = surf2.faceNormals();
const labelList& meshPoints = surf1.meshPoints();
if (debug)
{
Pout<< "Calculating intersection of " << edgeLabels.size() << " edges"
<< " out of " << surf1.nEdges() << " with " << surf2.size()
<< " triangles ..." << endl;
}
// Construct octree.
const indexedOctree<treeDataTriSurface>& tree = querySurf2.tree();
label nHits = 0;
// Go through all edges, calculate intersections
forAll(edgeLabels, i)
{
label edgeI = edgeLabels[i];
if (debug && (i % 1000 == 0))
{
Pout<< "Intersecting edge " << edgeI << " with surface" << endl;
}
const edge& e = surf1.edges()[edgeI];
const point& pStart = points1[meshPoints[e.start()]];
const point& pEnd = points1[meshPoints[e.end()]];
const vector eVec(pEnd - pStart);
const scalar eMag = mag(eVec);
const vector n(eVec/(eMag + VSMALL));
// Smallish length for intersection calculation errors.
const point tolVec = 1e-6*eVec;
// Start tracking somewhat before pStart and upto somewhat after p1.
// Note that tolerances here are smaller than those used to classify
// hit below.
// This will cause this hit to be marked as degenerate and resolved
// later on.
point p0 = pStart - 0.5*surf1PointTol[e[0]]*n;
const point p1 = pEnd + 0.5*surf1PointTol[e[1]]*n;
const scalar maxS = mag(p1 - pStart);
// Get all intersections of the edge with the surface
DynamicList<pointIndexHit> currentIntersections(100);
DynamicList<label> currentIntersectionTypes(100);
while (true)
{
pointIndexHit pHit = tree.findLine(p0, p1);
if (pHit.hit())
{
nHits++;
currentIntersections.append(pHit);
// Classify point on surface1 edge.
label edgeEnd = -1;
if (mag(pHit.hitPoint() - pStart) < surf1PointTol[e[0]])
{
edgeEnd = 0;
}
else if (mag(pHit.hitPoint() - pEnd) < surf1PointTol[e[1]])
{
edgeEnd = 1;
}
else if (mag(n & normals2[pHit.index()]) < alignedCos_)
{
Pout<< "Flat angle edge:" << edgeI
<< " face:" << pHit.index()
<< " cos:" << mag(n & normals2[pHit.index()])
<< endl;
edgeEnd = 2;
}
currentIntersectionTypes.append(edgeEnd);
if (edgeEnd == 1)
{
// Close to end
//.........这里部分代码省略.........