A collection of tools for triSurface. More...
Public Types | |
enum | sideType { UNKNOWN, INSIDE, OUTSIDE } |
On which side of surface. More... | |
Public Member Functions | |
triSurface | triangulateFaceCentre (const polyBoundaryMesh &mBesh, const labelHashSet &includePatches, const bool verbose=false) |
Face-centre triangulation of (selected patches of) boundaryMesh. More... | |
Static Public Member Functions | |
static void | writeOBJ (const fileName &fName, const pointField &pts) |
Write pointField to OBJ format file. More... | |
static void | writeOBJ (const triSurface &surf, const fileName &fName, const boolList &markedVerts) |
Write vertex subset to OBJ format file. More... | |
static void | getVertexTriangles (const triSurface &surf, const label edgeI, labelList &edgeTris) |
Get all triangles using edge endpoint. More... | |
static labelList | getVertexVertices (const triSurface &surf, const edge &e) |
Get all vertices (local numbering) connected to vertices of edge. More... | |
static label | otherFace (const triSurface &surf, const label facei, const label edgeI) |
Get face connected to edge not facei. More... | |
static void | otherEdges (const triSurface &surf, const label facei, const label edgeI, label &e1, label &e2) |
Get the two edges on facei counterclockwise after edgeI. More... | |
static void | otherVertices (const triSurface &surf, const label facei, const label vertI, label &vert1I, label &vert2I) |
Get the two vertices (local numbering) on facei counterclockwise. More... | |
static label | oppositeEdge (const triSurface &surf, const label facei, const label vertI) |
Get edge opposite vertex (local numbering) More... | |
static label | oppositeVertex (const triSurface &surf, const label facei, const label edgeI) |
Get vertex (local numbering) opposite edge. More... | |
static label | getEdge (const triSurface &surf, const label vert1I, const label vert2I) |
Returns edge label connecting v1, v2 (local numbering) More... | |
static label | getTriangle (const triSurface &surf, const label e0I, const label e1I, const label e2I) |
Return index of triangle (or -1) using all three edges. More... | |
static triSurface | collapseEdges (const triSurface &surf, const labelList &collapsableEdges) |
Create new triSurface by collapsing edges to edge mids. More... | |
static triSurface | collapseEdges (const triSurface &surf, const labelList &collapsableEdges, const pointField &edgeMids, labelList &faceStatus) |
Create new triSurface by collapsing edges to specified. More... | |
static triSurface | greenRefine (const triSurface &surf, const labelList &refineEdges) |
Refine edges by splitting to opposite vertex. More... | |
static triSurface | redGreenRefine (const triSurface &surf, const labelList &refineFaces) |
Refine face by splitting all edges. Neighbouring face is. More... | |
static label | minEdge (const triSurface &surf, const labelList &edgeIndices) |
Returns element in edgeIndices with minimum length. More... | |
static label | maxEdge (const triSurface &surf, const labelList &edgeIndices) |
Returns element in edgeIndices with minimum length. More... | |
static triSurface | mergePoints (const triSurface &surf, const scalar mergeTol) |
Merge points within distance. More... | |
static vector | surfaceNormal (const triSurface &surf, const label nearestFacei, const point &nearestPt) |
Triangle (unit) normal. If nearest point to triangle on edge use. More... | |
static sideType | edgeSide (const triSurface &surf, const point &sample, const point &nearestPoint, const label edgeI) |
If nearest point is on edgeI, determine on which side of surface. More... | |
static sideType | surfaceSide (const triSurface &surf, const point &sample, const label nearestFacei) |
Given nearest point (to sample) on surface determines which side. More... | |
static triSurface | triangulate (const polyBoundaryMesh &mBesh, const labelHashSet &includePatches, const bool verbose=false) |
Simple triangulation of (selected patches of) boundaryMesh. Needs. More... | |
static triSurface | triangulate (const polyBoundaryMesh &bMesh, const labelHashSet &includePatches, const boundBox &bBox, const bool verbose=false) |
static void | calcInterpolationWeights (const triPointRef &, const point &, FixedList< scalar, 3 > &weights) |
Calculate linear interpolation weights for point (guaranteed to be. More... | |
static void | calcInterpolationWeights (const triSurface &s, const pointField &samplePts, List< FixedList< label, 3 >> &verts, List< FixedList< scalar, 3 >> &weights) |
static triSurface | delaunay2D (const List< vector2D > &) |
Do unconstrained Delaunay of points. Returns triSurface with 3D. More... | |
static surfaceLocation | classify (const triSurface &, const label triI, const point &trianglePoint) |
Test point on plane of triangle to see if on edge or point or inside. More... | |
static surfaceLocation | trackToEdge (const triSurface &, const surfaceLocation &start, const surfaceLocation &end, const plane &cutPlane) |
Track on surface to get closer to point. More... | |
static void | track (const triSurface &, const surfaceLocation &endInfo, const plane &cutPlane, surfaceLocation &hitInfo) |
Track from edge to edge across surface. Uses trackToEdge. More... | |
Static Public Attributes | |
static const label | ANYEDGE = -1 |
Face collapse status. More... | |
static const label | NOEDGE = -2 |
static const label | COLLAPSED = -3 |
enum sideType |
On which side of surface.
Enumerator | |
---|---|
UNKNOWN | |
INSIDE | |
OUTSIDE |
Definition at line 437 of file triSurfaceTools.H.
|
static |
Write pointField to OBJ format file.
Definition at line 1251 of file triSurfaceTools.C.
References Foam::endl(), forAll, Foam::Pout, List< T >::size(), Vector< Cmpt >::x(), Vector< Cmpt >::y(), and Vector< Cmpt >::z().
|
static |
Write vertex subset to OBJ format file.
Definition at line 1270 of file triSurfaceTools.C.
References Foam::endl(), forAll, triSurfaceTools::getVertexTriangles(), PrimitivePatch< FaceList, PointField >::localPoints(), Foam::Pout, Vector< Cmpt >::x(), Vector< Cmpt >::y(), and Vector< Cmpt >::z().
|
static |
Get all triangles using edge endpoint.
Definition at line 1300 of file triSurfaceTools.C.
References PrimitivePatch< FaceList, PointField >::edgeFaces(), PrimitivePatch< FaceList, PointField >::edges(), edge::end(), forAll, triSurfaceTools::getVertexVertices(), PrimitivePatch< FaceList, PointField >::pointFaces(), List< T >::setSize(), List< T >::size(), and edge::start().
Referenced by triSurfaceTools::writeOBJ().
|
static |
Get all vertices (local numbering) connected to vertices of edge.
Definition at line 1343 of file triSurfaceTools.C.
References PrimitivePatch< FaceList, PointField >::edges(), edge::end(), forAll, HashSet< Key, Hash >::insert(), triSurfaceTools::otherFace(), edge::otherVertex(), PrimitivePatch< FaceList, PointField >::pointEdges(), edge::start(), and HashTable< T, Key, Hash >::toc().
Referenced by triSurfaceTools::getVertexTriangles().
|
static |
Get face connected to edge not facei.
Definition at line 1428 of file triSurfaceTools.C.
References PrimitivePatch< FaceList, PointField >::edgeFaces(), triSurfaceTools::otherEdges(), and List< T >::size().
Referenced by triSurfaceTools::getVertexVertices().
|
static |
Get the two edges on facei counterclockwise after edgeI.
Definition at line 1456 of file triSurfaceTools.C.
References Foam::abort(), PrimitivePatch< FaceList, PointField >::edges(), PrimitivePatch< FaceList, PointField >::faceEdges(), Foam::FatalError, FatalErrorInFunction, UList< T >::fcIndex(), Foam::findIndex(), PrimitivePatch< FaceList, PointField >::localFaces(), and triSurfaceTools::otherVertices().
Referenced by triSurfaceTools::otherFace().
|
static |
Get the two vertices (local numbering) on facei counterclockwise.
vertI
Definition at line 1485 of file triSurfaceTools.C.
References Foam::abort(), Foam::FatalError, FatalErrorInFunction, PrimitivePatch< FaceList, PointField >::localFaces(), and triSurfaceTools::oppositeEdge().
Referenced by triSurfaceTools::otherEdges().
|
static |
Get edge opposite vertex (local numbering)
Definition at line 1520 of file triSurfaceTools.C.
References Foam::abort(), PrimitivePatch< FaceList, PointField >::edges(), edge::end(), PrimitivePatch< FaceList, PointField >::faceEdges(), Foam::FatalError, FatalErrorInFunction, forAll, triSurfaceTools::oppositeVertex(), and edge::start().
Referenced by triSurfaceTools::otherVertices().
|
static |
Get vertex (local numbering) opposite edge.
Definition at line 1550 of file triSurfaceTools.C.
References Foam::abort(), PrimitivePatch< FaceList, PointField >::edges(), edge::end(), Foam::FatalError, FatalErrorInFunction, forAll, triSurfaceTools::getEdge(), PrimitivePatch< FaceList, PointField >::localFaces(), and edge::start().
Referenced by triSurfaceTools::collapseEdges(), and triSurfaceTools::oppositeEdge().
|
static |
Returns edge label connecting v1, v2 (local numbering)
Definition at line 1579 of file triSurfaceTools.C.
References PrimitivePatch< FaceList, PointField >::edges(), edge::end(), forAll, triSurfaceTools::getTriangle(), PrimitivePatch< FaceList, PointField >::pointEdges(), and edge::start().
Referenced by triSurfaceTools::oppositeVertex().
|
static |
Return index of triangle (or -1) using all three edges.
Definition at line 1603 of file triSurfaceTools.C.
References Foam::abort(), triSurfaceTools::collapseEdges(), PrimitivePatch< FaceList, PointField >::edgeFaces(), PrimitivePatch< FaceList, PointField >::faceEdges(), Foam::FatalError, FatalErrorInFunction, and forAll.
Referenced by triSurfaceTools::getEdge().
|
static |
Create new triSurface by collapsing edges to edge mids.
Definition at line 1650 of file triSurfaceTools.C.
References triSurfaceTools::ANYEDGE, PrimitivePatch< FaceList, PointField >::edges(), edge::end(), forAll, PrimitivePatch< FaceList, PointField >::localPoints(), PrimitivePatch< FaceList, PointField >::nEdges(), List< T >::size(), and edge::start().
Referenced by triSurfaceTools::getTriangle().
|
static |
Create new triSurface by collapsing edges to specified.
positions. faceStatus allows explicit control over which faces need to be protected (see above). faceStatus gets updated to protect collapsing already collapsed faces.
Definition at line 1703 of file triSurfaceTools.C.
References Foam::abort(), triSurfaceTools::ANYEDGE, Foam::constant::physicoChemical::b, Foam::constant::universal::c, triSurfaceTools::COLLAPSED, PrimitivePatch< FaceList, PointField >::edgeFaces(), PrimitivePatch< FaceList, PointField >::edges(), edge::end(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, forAll, PrimitivePatch< FaceList, PointField >::localFaces(), PrimitivePatch< FaceList, PointField >::localPoints(), Foam::min(), PrimitivePatch< FaceList, PointField >::nEdges(), triSurfaceTools::oppositeVertex(), triSurface::patches(), triSurfaceTools::redGreenRefine(), FixedList< T, Size >::setSize(), List< T >::size(), edge::start(), and HashTable< T, Key, Hash >::toc().
|
static |
Refine edges by splitting to opposite vertex.
Definition at line 1884 of file triSurfaceTools.C.
References List< T >::append(), PrimitivePatch< FaceList, PointField >::edgeFaces(), PrimitivePatch< FaceList, PointField >::edges(), edge::end(), forAll, PrimitivePatch< FaceList, PointField >::localFaces(), PrimitivePatch< FaceList, PointField >::localPoints(), triSurfaceTools::minEdge(), PrimitivePatch< FaceList, PointField >::nEdges(), newPointi, PrimitivePatch< FaceList, PointField >::nPoints(), triSurface::patches(), List< T >::setSize(), List< T >::size(), and edge::start().
|
static |
Refine face by splitting all edges. Neighbouring face is.
greenRefine'd.
Definition at line 1865 of file triSurfaceTools.C.
References forAll, and List< T >::size().
Referenced by triSurfaceTools::collapseEdges().
|
static |
Returns element in edgeIndices with minimum length.
Definition at line 1976 of file triSurfaceTools.C.
References PrimitivePatch< FaceList, PointField >::edges(), edge::end(), forAll, PrimitivePatch< FaceList, PointField >::localPoints(), Foam::mag(), triSurfaceTools::maxEdge(), and edge::start().
Referenced by triSurfaceTools::greenRefine().
|
static |
Returns element in edgeIndices with minimum length.
Definition at line 2006 of file triSurfaceTools.C.
References PrimitivePatch< FaceList, PointField >::edges(), edge::end(), forAll, PrimitivePatch< FaceList, PointField >::localPoints(), Foam::mag(), triSurfaceTools::mergePoints(), and edge::start().
Referenced by triSurfaceTools::minEdge().
|
static |
Merge points within distance.
Definition at line 2036 of file triSurfaceTools.C.
References forAll, PrimitivePatch< FaceList, PointField >::localFaces(), PrimitivePatch< FaceList, PointField >::localPoints(), Foam::mergePoints(), PrimitivePatch< FaceList, PointField >::nPoints(), triSurface::patches(), FixedList< T, Size >::setSize(), List< T >::size(), and triSurfaceTools::surfaceNormal().
Referenced by triSurfaceTools::maxEdge().
|
static |
Triangle (unit) normal. If nearest point to triangle on edge use.
edge normal (calculated on the fly); if on vertex use vertex normal. Uses planarTol.
Definition at line 2095 of file triSurfaceTools.C.
References triangle< Point, PointRef >::EDGE, PrimitivePatch< FaceList, PointField >::edgeFaces(), triSurfaceTools::edgeSide(), PrimitivePatch< FaceList, PointField >::faceEdges(), PrimitivePatch< FaceList, PointField >::faceNormals(), forAll, PrimitivePatch< FaceList, PointField >::localFaces(), Foam::mag(), triangle< Point, PointRef >::NONE, PrimitivePatch< FaceList, PointField >::pointNormals(), PrimitivePatch< FaceList, PointField >::points(), and Foam::Zero.
Referenced by triSurfaceTools::mergePoints().
|
static |
If nearest point is on edgeI, determine on which side of surface.
sample is.
Definition at line 2139 of file triSurfaceTools.C.
References PrimitivePatch< FaceList, PointField >::edgeFaces(), PrimitivePatch< FaceList, PointField >::faceNormals(), triSurfaceTools::INSIDE, n, triSurfaceTools::OUTSIDE, List< T >::size(), triSurfaceTools::surfaceSide(), and triSurfaceTools::UNKNOWN.
Referenced by triSurfaceTools::surfaceNormal(), and triSurfaceTools::surfaceSide().
|
static |
Given nearest point (to sample) on surface determines which side.
sample is. Uses either face normal, edge normal or point normal (non-trivial). Uses triangle::classify.
Definition at line 2176 of file triSurfaceTools.C.
References Foam::abort(), Foam::constant::universal::c, triangle< Point, PointRef >::EDGE, PrimitivePatch< FaceList, PointField >::edges(), triSurfaceTools::edgeSide(), PrimitivePatch< FaceList, PointField >::faceEdges(), PrimitivePatch< FaceList, PointField >::faceNormals(), Foam::FatalError, FatalErrorInFunction, forAll, triSurfaceTools::INSIDE, PrimitivePatch< FaceList, PointField >::localFaces(), PrimitivePatch< FaceList, PointField >::localPoints(), Foam::mag(), Foam::magSqr(), triangle< Point, PointRef >::NONE, edge::otherVertex(), triSurfaceTools::OUTSIDE, PrimitivePatch< FaceList, PointField >::pointEdges(), PrimitivePatch< FaceList, PointField >::points(), PointHit< Point >::rawPoint(), Foam::sqr(), and triSurfaceTools::triangulate().
Referenced by triSurfaceTools::edgeSide().
|
static |
Simple triangulation of (selected patches of) boundaryMesh. Needs.
polyMesh (or polyBoundaryMesh) since only at this level are the triangles on neighbouring patches connected.
Definition at line 2332 of file triSurfaceTools.C.
References Foam::endl(), forAll, forAllConstIter, mesh, polyBoundaryMesh::mesh(), patchIdentifier::name(), IOobject::name(), primitiveMesh::nFaces(), primitiveMesh::nInternalFaces(), triSurface::patches(), patchi, PrimitivePatch< FaceList, PointField >::points(), polyMesh::points(), Foam::Pout, and List< T >::setSize().
Referenced by powerLawLopesdaCostaZone::powerLawLopesdaCostaZone(), and triSurfaceTools::surfaceSide().
|
static |
Definition at line 2417 of file triSurfaceTools.C.
References boundBox::containsAny(), Foam::endl(), forAll, forAllConstIter, mesh, polyBoundaryMesh::mesh(), patchIdentifier::name(), IOobject::name(), primitiveMesh::nFaces(), primitiveMesh::nInternalFaces(), triSurface::patches(), patchi, PrimitivePatch< FaceList, PointField >::points(), polyMesh::points(), Foam::Pout, List< T >::setSize(), and triSurfaceTools::triangulateFaceCentre().
Foam::triSurface triangulateFaceCentre | ( | const polyBoundaryMesh & | mBesh, |
const labelHashSet & | includePatches, | ||
const bool | verbose = false |
||
) |
Face-centre triangulation of (selected patches of) boundaryMesh.
Needs polyMesh (or polyBoundaryMesh) since only at this level are the triangles on neighbouring patches connected.
Definition at line 2507 of file triSurfaceTools.C.
References Foam::endl(), primitiveMesh::faceCentres(), UList< T >::fcIndex(), forAll, forAllConstIter, PrimitivePatch< FaceList, PointField >::localFaces(), PrimitivePatch< FaceList, PointField >::localPoints(), mesh, polyBoundaryMesh::mesh(), patchIdentifier::name(), IOobject::name(), primitiveMesh::nFaces(), primitiveMesh::nInternalFaces(), triSurface::patches(), patchi, polyMesh::points(), Foam::Pout, List< T >::setSize(), DynamicList< T, SizeInc, SizeMult, SizeDiv >::shrink(), List< T >::size(), and polyPatch::start().
Referenced by triSurfaceTools::triangulate().
|
static |
Calculate linear interpolation weights for point (guaranteed to be.
inside triangle)
Definition at line 2674 of file triSurfaceTools.C.
References triangle< Point, PointRef >::a(), triangle< Point, PointRef >::b(), triangle< Point, PointRef >::c(), Foam::mag(), and Foam::max().
Referenced by triSurfaceTools::calcInterpolationWeights(), and triSurfaceTools::delaunay2D().
|
static |
Definition at line 2706 of file triSurfaceTools.C.
References triSurfaceTools::calcInterpolationWeights(), triSurfaceTools::classify(), PointHit< Point >::distance(), triangle< Point, PointRef >::EDGE, FixedList< T, Size >::fcIndex(), forAll, PointHit< Point >::hit(), Foam::mag(), Foam::max(), Foam::min(), triangle< Point, PointRef >::nearestPointClassify(), triangle< Point, PointRef >::POINT, PrimitivePatch< FaceList, PointField >::points(), PointHit< Point >::rawPoint(), s(), List< T >::size(), and triFace::tri().
|
static |
Do unconstrained Delaunay of points. Returns triSurface with 3D.
points with z=0. All triangles in region 0.
Definition at line 2608 of file triSurfaceTools.C.
References Foam::abort(), UList< T >::begin(), triSurfaceTools::calcInterpolationWeights(), dtris2(), Foam::FatalError, FatalErrorInFunction, forAll, points, and List< T >::size().
|
static |
Test point on plane of triangle to see if on edge or point or inside.
Definition at line 2838 of file triSurfaceTools.C.
References triangle< Point, PointRef >::EDGE, surfaceLocation::elementType(), PrimitivePatch< FaceList, PointField >::faceEdges(), PrimitivePatch< FaceList, PointField >::localFaces(), triangle< Point, PointRef >::NONE, triangle< Point, PointRef >::POINT, PrimitivePatch< FaceList, PointField >::points(), PointIndexHit< Point >::setHit(), PointIndexHit< Point >::setIndex(), PointIndexHit< Point >::setMiss(), PointIndexHit< Point >::setPoint(), and triSurfaceTools::trackToEdge().
Referenced by triSurfaceTools::calcInterpolationWeights().
|
static |
Track on surface to get closer to point.
Possible situations:
Definition at line 2882 of file triSurfaceTools.C.
References triangle< Point, PointRef >::EDGE, PrimitivePatch< FaceList, PointField >::edgeFaces(), surfaceLocation::elementType(), PointIndexHit< Point >::hit(), PointIndexHit< Point >::index(), triangle< Point, PointRef >::NONE, pFaces, PrimitivePatch< FaceList, PointField >::pointFaces(), PointIndexHit< Point >::rawPoint(), PointIndexHit< Point >::setMiss(), triSurfaceTools::track(), and surfaceLocation::triangle().
Referenced by triSurfaceTools::classify(), and triSurfaceTools::track().
|
static |
Track from edge to edge across surface. Uses trackToEdge.
Not really useful by itself, more example of how to use trackToEdge. endInfo should be location on surface. hitInfo should be initialised to starting location (on surface as well). Upon return is set to end location.
Definition at line 2960 of file triSurfaceTools.C.
References PointIndexHit< Point >::hit(), triSurfaceTools::trackToEdge(), and surfaceLocation::triangle().
Referenced by triSurfaceTools::trackToEdge().
|
static |
Face collapse status.
anyEdge: any edge can be collapsed noEdge: no edge can be collapsed collapsed: already collapsed >0: edge label that can be collapsed
Definition at line 367 of file triSurfaceTools.H.
Referenced by triSurfaceTools::collapseEdges().
|
static |
Definition at line 368 of file triSurfaceTools.H.
|
static |
Definition at line 369 of file triSurfaceTools.H.
Referenced by triSurfaceTools::collapseEdges().