当前位置: 首页>>代码示例>>C++>>正文


C++ triSurface::nEdges方法代码示例

本文整理汇总了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;
    }
开发者ID:iYohey,项目名称:OpenFOAM-dev,代码行数:54,代码来源:edgeIntersections.C

示例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
//.........这里部分代码省略.........
开发者ID:TsukasaHori,项目名称:openfoam-extend-foam-extend-3.1,代码行数:101,代码来源:edgeIntersections.C


注:本文中的triSurface::nEdges方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。