A collection of tools for triSurfaceMesh. More...
#include <meshTools/triSurfaceTools.H>
A collection of tools for triSurfaceMesh.
Definition at line 63 of file triSurfaceTools.H.
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.
| |
Static Public Member Functions | |
static void | writeOBJ (const fileName &fName, const pointField &pts) |
Write pointField to OBJ format file.
| |
static void | writeOBJ (const triSurface &surf, const fileName &fName, const boolList &markedVerts) |
Write vertex subset to OBJ format file.
| |
static void | getVertexTriangles (const triSurface &surf, const label edgeI, labelList &edgeTris) |
Get all triangles using edge endpoint.
| |
static labelList | getVertexVertices (const triSurface &surf, const edge &e) |
Get all vertices (local numbering) connected to vertices of edge.
| |
static label | otherFace (const triSurface &surf, const label faceI, const label edgeI) |
Get face connected to edge not faceI.
| |
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.
| |
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.
| |
static label | oppositeEdge (const triSurface &surf, const label faceI, const label vertI) |
Get edge opposite vertex (local numbering)
| |
static label | oppositeVertex (const triSurface &surf, const label faceI, const label edgeI) |
Get vertex (local numbering) opposite edge.
| |
static label | getEdge (const triSurface &surf, const label vert1I, const label vert2I) |
Returns edge label connecting v1, v2 (local numbering)
| |
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.
| |
static triSurface | collapseEdges (const triSurface &surf, const labelList &collapsableEdges) |
Create new triSurface by collapsing edges to edge mids.
| |
static triSurface | collapseEdges (const triSurface &surf, const labelList &collapsableEdges, const pointField &edgeMids, labelList &faceStatus) |
Create new triSurface by collapsing edges to specified.
| |
static triSurface | greenRefine (const triSurface &surf, const labelList &refineEdges) |
Refine edges by splitting to opposite vertex.
| |
static triSurface | redGreenRefine (const triSurface &surf, const labelList &refineFaces) |
Refine face by splitting all edges. Neighbouring face is.
| |
static label | minEdge (const triSurface &surf, const labelList &edgeIndices) |
Returns element in edgeIndices with minimum length.
| |
static label | maxEdge (const triSurface &surf, const labelList &edgeIndices) |
Returns element in edgeIndices with minimum length.
| |
static triSurface | mergePoints (const triSurface &surf, const scalar mergeTol) |
Merge points within distance.
| |
static vector | surfaceNormal (const triSurface &surf, const label nearestFaceI, const point &nearestPt) |
Triangle (unit) normal. If nearest point to triangle on edge use.
| |
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
| |
static sideType | surfaceSide (const triSurface &surf, const point &sample, const label nearestFaceI, const point &nearestPt, const scalar tol) |
Given nearest point (to sample) on surface determines which side.
| |
static triSurface | triangulate (const polyBoundaryMesh &mBesh, const labelHashSet &includePatches, const bool verbose=false) |
Simple triangulation of (selected patches of) boundaryMesh. Needs.
| |
static void | calcInterpolationWeights (const triPointRef &, const point &, FixedList< scalar, 3 > &weights) |
Calculate linear interpolation weights for point (guaranteed to be.
| |
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.
| |
static surfaceLocation | classify (const triSurface &, const label triI, const point &trianglePoint) |
Test point on plane of triangle to see if on edge or point.
| |
static surfaceLocation | trackToEdge (const triSurface &, const surfaceLocation &start, const surfaceLocation &end, const plane &cutPlane) |
Track on surface to get closer to point. Possible situations:
| |
static void | track (const triSurface &, const surfaceLocation &endInfo, const plane &cutPlane, surfaceLocation &hitInfo) |
Track from edge to edge across surface. Uses trackToEdge.
| |
Static Public Attributes | |
static const label | ANYEDGE = -1 |
Face collapse status.
| |
static const label | NOEDGE = -2 |
static const label | COLLAPSED = -3 |
enum sideType |
on which side of surface
Definition at line 437 of file triSurfaceTools.H.
void writeOBJ | ( | const fileName & | fName, |
const pointField & | pts | ||
) | [static]
|
Write pointField to OBJ format file.
Definition at line 1255 of file triSurfaceTools.C.
References Foam::endl(), forAll, Foam::Pout, List< T >::size(), Vector< Cmpt >::x(), Vector< Cmpt >::y(), and Vector< Cmpt >::z().
void writeOBJ | ( | const triSurface & | surf, |
const fileName & | fName, | ||
const boolList & | markedVerts | ||
) | [static]
|
Write vertex subset to OBJ format file.
Definition at line 1274 of file triSurfaceTools.C.
References Foam::endl(), forAll, PrimitivePatch< Face, FaceList, PointField, PointType >::localPoints(), Foam::Pout, Vector< Cmpt >::x(), Vector< Cmpt >::y(), and Vector< Cmpt >::z().
void getVertexTriangles | ( | const triSurface & | surf, |
const label | edgeI, | ||
labelList & | edgeTris | ||
) | [static]
|
Get all triangles using edge endpoint.
Definition at line 1304 of file triSurfaceTools.C.
References PrimitivePatch< Face, FaceList, PointField, PointType >::edgeFaces(), PrimitivePatch< Face, FaceList, PointField, PointType >::edges(), edge::end(), forAll, PrimitivePatch< Face, FaceList, PointField, PointType >::pointFaces(), List< T >::setSize(), List< T >::size(), and edge::start().
Foam::labelList getVertexVertices | ( | const triSurface & | surf, |
const edge & | e | ||
) | [static]
|
Get all vertices (local numbering) connected to vertices of edge.
Definition at line 1347 of file triSurfaceTools.C.
References PrimitivePatch< Face, FaceList, PointField, PointType >::edges(), edge::end(), forAll, HashSet< Key, Hash >::insert(), edge::otherVertex(), PrimitivePatch< Face, FaceList, PointField, PointType >::pointEdges(), edge::start(), HashTable< T, Key, Hash >::toc(), v1, and v2.
Foam::label otherFace | ( | const triSurface & | surf, |
const label | faceI, | ||
const label | edgeI | ||
) | [static]
|
Get face connected to edge not faceI.
Definition at line 1432 of file triSurfaceTools.C.
References PrimitivePatch< Face, FaceList, PointField, PointType >::edgeFaces(), and List< T >::size().
void otherEdges | ( | const triSurface & | surf, |
const label | faceI, | ||
const label | edgeI, | ||
label & | e1, | ||
label & | e2 | ||
) | [static]
|
Get the two edges on faceI counterclockwise after edgeI.
Definition at line 1460 of file triSurfaceTools.C.
References Foam::abort(), PrimitivePatch< Face, FaceList, PointField, PointType >::edges(), PrimitivePatch< Face, FaceList, PointField, PointType >::faceEdges(), Foam::FatalError, FatalErrorIn, UList< T >::fcIndex(), Foam::findIndex(), and PrimitivePatch< Face, FaceList, PointField, PointType >::localFaces().
void otherVertices | ( | const triSurface & | surf, |
const label | faceI, | ||
const label | vertI, | ||
label & | vert1I, | ||
label & | vert2I | ||
) | [static]
|
Get the two vertices (local numbering) on faceI counterclockwise.
vertI
Definition at line 1493 of file triSurfaceTools.C.
References Foam::abort(), Foam::FatalError, FatalErrorIn, and PrimitivePatch< Face, FaceList, PointField, PointType >::localFaces().
Foam::label oppositeEdge | ( | const triSurface & | surf, |
const label | faceI, | ||
const label | vertI | ||
) | [static]
|
Get edge opposite vertex (local numbering)
Definition at line 1532 of file triSurfaceTools.C.
References Foam::abort(), PrimitivePatch< Face, FaceList, PointField, PointType >::edges(), edge::end(), PrimitivePatch< Face, FaceList, PointField, PointType >::faceEdges(), Foam::FatalError, FatalErrorIn, forAll, and edge::start().
Foam::label oppositeVertex | ( | const triSurface & | surf, |
const label | faceI, | ||
const label | edgeI | ||
) | [static]
|
Get vertex (local numbering) opposite edge.
Definition at line 1565 of file triSurfaceTools.C.
References Foam::abort(), PrimitivePatch< Face, FaceList, PointField, PointType >::edges(), edge::end(), Foam::FatalError, FatalErrorIn, forAll, PrimitivePatch< Face, FaceList, PointField, PointType >::localFaces(), and edge::start().
Foam::label getEdge | ( | const triSurface & | surf, |
const label | vert1I, | ||
const label | vert2I | ||
) | [static]
|
Returns edge label connecting v1, v2 (local numbering)
Definition at line 1595 of file triSurfaceTools.C.
References PrimitivePatch< Face, FaceList, PointField, PointType >::edges(), edge::end(), forAll, PrimitivePatch< Face, FaceList, PointField, PointType >::pointEdges(), edge::start(), v1, and v2.
Foam::label getTriangle | ( | const triSurface & | surf, |
const label | e0I, | ||
const label | e1I, | ||
const label | e2I | ||
) | [static]
|
Return index of triangle (or -1) using all three edges.
Definition at line 1620 of file triSurfaceTools.C.
References Foam::abort(), PrimitivePatch< Face, FaceList, PointField, PointType >::edgeFaces(), PrimitivePatch< Face, FaceList, PointField, PointType >::faceEdges(), Foam::FatalError, FatalErrorIn, and forAll.
Foam::triSurface collapseEdges | ( | const triSurface & | surf, |
const labelList & | collapsableEdges | ||
) | [static]
|
Create new triSurface by collapsing edges to edge mids.
Definition at line 1671 of file triSurfaceTools.C.
References PrimitivePatch< Face, FaceList, PointField, PointType >::edges(), edge::end(), forAll, PrimitivePatch< Face, FaceList, PointField, PointType >::localPoints(), PrimitivePatch< Face, FaceList, PointField, PointType >::nEdges(), List< T >::size(), and edge::start().
Foam::triSurface collapseEdges | ( | const triSurface & | surf, |
const labelList & | collapsableEdges, | ||
const pointField & | edgeMids, | ||
labelList & | faceStatus | ||
) | [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 1724 of file triSurfaceTools.C.
References Foam::abort(), b, PrimitivePatch< Face, FaceList, PointField, PointType >::edgeFaces(), PrimitivePatch< Face, FaceList, PointField, PointType >::edges(), edge::end(), Foam::endl(), Foam::FatalError, FatalErrorIn, forAll, PrimitivePatch< Face, FaceList, PointField, PointType >::localFaces(), PrimitivePatch< Face, FaceList, PointField, PointType >::localPoints(), Foam::min(), PrimitivePatch< Face, FaceList, PointField, PointType >::nEdges(), triSurface::patches(), FixedList< T, Size >::setSize(), List< T >::size(), and edge::start().
Foam::triSurface greenRefine | ( | const triSurface & | surf, |
const labelList & | refineEdges | ||
) | [static]
|
Refine edges by splitting to opposite vertex.
Definition at line 1905 of file triSurfaceTools.C.
References List< T >::append(), PrimitivePatch< Face, FaceList, PointField, PointType >::edgeFaces(), PrimitivePatch< Face, FaceList, PointField, PointType >::edges(), edge::end(), forAll, PrimitivePatch< Face, FaceList, PointField, PointType >::localFaces(), PrimitivePatch< Face, FaceList, PointField, PointType >::localPoints(), PrimitivePatch< Face, FaceList, PointField, PointType >::nEdges(), PrimitivePatch< Face, FaceList, PointField, PointType >::nPoints(), triSurface::patches(), List< T >::setSize(), List< T >::size(), and edge::start().
Foam::triSurface redGreenRefine | ( | const triSurface & | surf, |
const labelList & | refineFaces | ||
) | [static]
|
Refine face by splitting all edges. Neighbouring face is.
greenRefine'd.
Definition at line 1886 of file triSurfaceTools.C.
References forAll, and List< T >::size().
Foam::label minEdge | ( | const triSurface & | surf, |
const labelList & | edgeIndices | ||
) | [static]
|
Returns element in edgeIndices with minimum length.
Definition at line 1997 of file triSurfaceTools.C.
References PrimitivePatch< Face, FaceList, PointField, PointType >::edges(), edge::end(), forAll, PrimitivePatch< Face, FaceList, PointField, PointType >::localPoints(), Foam::mag(), and edge::start().
Foam::label maxEdge | ( | const triSurface & | surf, |
const labelList & | edgeIndices | ||
) | [static]
|
Returns element in edgeIndices with minimum length.
Definition at line 2027 of file triSurfaceTools.C.
References PrimitivePatch< Face, FaceList, PointField, PointType >::edges(), edge::end(), forAll, PrimitivePatch< Face, FaceList, PointField, PointType >::localPoints(), Foam::mag(), and edge::start().
Foam::triSurface mergePoints | ( | const triSurface & | surf, |
const scalar | mergeTol | ||
) | [static]
|
Merge points within distance.
Definition at line 2057 of file triSurfaceTools.C.
References forAll, PrimitivePatch< Face, FaceList, PointField, PointType >::localFaces(), PrimitivePatch< Face, FaceList, PointField, PointType >::localPoints(), Foam::mergePoints(), PrimitivePatch< Face, FaceList, PointField, PointType >::nPoints(), triSurface::patches(), FixedList< T, Size >::setSize(), and List< T >::size().
Foam::vector surfaceNormal | ( | const triSurface & | surf, |
const label | nearestFaceI, | ||
const point & | nearestPt | ||
) | [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 2115 of file triSurfaceTools.C.
References E(), triangle< Point, PointRef >::EDGE, PrimitivePatch< Face, FaceList, PointField, PointType >::edgeFaces(), PrimitivePatch< Face, FaceList, PointField, PointType >::faceEdges(), PrimitivePatch< Face, FaceList, PointField, PointType >::faceNormals(), forAll, PrimitivePatch< Face, FaceList, PointField, PointType >::localFaces(), Foam::mag(), triangle< Point, PointRef >::NONE, PrimitivePatch< Face, FaceList, PointField, PointType >::pointNormals(), PrimitivePatch< Face, FaceList, PointField, PointType >::points(), and Vector< Cmpt >::zero.
Referenced by octreeDataTriSurface::getSampleType().
Foam::triSurfaceTools::sideType edgeSide | ( | const triSurface & | surf, |
const point & | sample, | ||
const point & | nearestPoint, | ||
const label | edgeI | ||
) | [static]
|
if nearest point is on edgeI, determine on which side of surface
sample is.
Definition at line 2164 of file triSurfaceTools.C.
References PrimitivePatch< Face, FaceList, PointField, PointType >::edgeFaces(), PrimitivePatch< Face, FaceList, PointField, PointType >::faceNormals(), and List< T >::size().
Foam::triSurfaceTools::sideType surfaceSide | ( | const triSurface & | surf, |
const point & | sample, | ||
const label | nearestFaceI, | ||
const point & | nearestPt, | ||
const scalar | tol | ||
) | [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 2201 of file triSurfaceTools.C.
References Foam::abort(), triangle< Point, PointRef >::EDGE, PrimitivePatch< Face, FaceList, PointField, PointType >::edges(), PrimitivePatch< Face, FaceList, PointField, PointType >::faceEdges(), PrimitivePatch< Face, FaceList, PointField, PointType >::faceNormals(), Foam::FatalError, FatalErrorIn, forAll, PrimitivePatch< Face, FaceList, PointField, PointType >::localFaces(), PrimitivePatch< Face, FaceList, PointField, PointType >::localPoints(), Foam::mag(), Foam::magSqr(), triangle< Point, PointRef >::NONE, edge::otherVertex(), PrimitivePatch< Face, FaceList, PointField, PointType >::pointEdges(), PrimitivePatch< Face, FaceList, PointField, PointType >::points(), and Foam::sqr().
Referenced by treeDataTriSurface::getVolumeType().
Foam::triSurface triangulate | ( | const polyBoundaryMesh & | mBesh, |
const labelHashSet & | includePatches, | ||
const bool | verbose = false
|
||
) | [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 2330 of file triSurfaceTools.C.
References List< T >::append(), HashTable< T, Key, Hash >::begin(), HashTable< T, Key, Hash >::end(), Foam::endl(), forAll, polyBoundaryMesh::mesh(), mesh, IOobject::name(), patchIdentifier::name(), primitiveMesh::nFaces(), primitiveMesh::nInternalFaces(), face::nTriangles(), triSurface::patches(), polyMesh::points(), PrimitivePatch< Face, FaceList, PointField, PointType >::points(), Foam::Pout, List< T >::setSize(), DynamicList< T, SizeInc, SizeMult, SizeDiv >::shrink(), and face::triangles().
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 2431 of file triSurfaceTools.C.
References HashTable< T, Key, Hash >::begin(), HashTable< T, Key, Hash >::end(), Foam::endl(), primitiveMesh::faceCentres(), forAll, PrimitivePatch< Face, FaceList, PointField, PointType >::localFaces(), PrimitivePatch< Face, FaceList, PointField, PointType >::localPoints(), polyBoundaryMesh::mesh(), mesh, IOobject::name(), patchIdentifier::name(), primitiveMesh::nFaces(), primitiveMesh::nInternalFaces(), triSurface::patches(), polyMesh::points(), Foam::Pout, List< T >::setSize(), DynamicList< T, SizeInc, SizeMult, SizeDiv >::shrink(), List< T >::size(), and polyPatch::start().
void calcInterpolationWeights | ( | const triPointRef & | tri, |
const point & | p, | ||
FixedList< scalar, 3 > & | weights | ||
) | [static]
|
Calculate linear interpolation weights for point (guaranteed to be.
inside triangle)
Definition at line 2682 of file triSurfaceTools.C.
References triangle< Point, PointRef >::a(), triangle< Point, PointRef >::b(), triangle< Point, PointRef >::c(), Foam::mag(), and Foam::max().
void calcInterpolationWeights | ( | const triSurface & | s, |
const pointField & | samplePts, | ||
List< FixedList< label, 3 > > & | verts, | ||
List< FixedList< scalar, 3 > > & | weights | ||
) | [static]
|
Definition at line 2714 of file triSurfaceTools.C.
References triangle< Point, PointRef >::classify(), E(), triangle< Point, PointRef >::EDGE, FixedList< T, Size >::fcIndex(), forAll, Foam::mag(), Foam::max(), Foam::min(), triangle< Point, PointRef >::POINT, PrimitivePatch< Face, FaceList, PointField, PointType >::points(), List< T >::size(), and triFace::tri().
Foam::triSurface delaunay2D | ( | const List< vector2D > & | pts ) | [static]
|
Do unconstrained Delaunay of points. Returns triSurface with 3D.
points with z=0. All triangles in region 0.
Definition at line 2545 of file triSurfaceTools.C.
References UList< T >::begin(), dtris2(), forAll, points, and List< T >::size().
Foam::surfaceLocation classify | ( | const triSurface & | s, |
const label | triI, | ||
const point & | trianglePoint | ||
) | [static]
|
Test point on plane of triangle to see if on edge or point.
or inside.
Definition at line 2841 of file triSurfaceTools.C.
References E(), triangle< Point, PointRef >::EDGE, surfaceLocation::elementType(), PrimitivePatch< Face, FaceList, PointField, PointType >::faceEdges(), PrimitivePatch< Face, FaceList, PointField, PointType >::localFaces(), triangle< Point, PointRef >::NONE, triangle< Point, PointRef >::POINT, PrimitivePatch< Face, FaceList, PointField, PointType >::points(), PointIndexHit< Point >::setHit(), PointIndexHit< Point >::setIndex(), PointIndexHit< Point >::setMiss(), and PointIndexHit< Point >::setPoint().
Foam::surfaceLocation trackToEdge | ( | const triSurface & | s, |
const surfaceLocation & | start, | ||
const surfaceLocation & | end, | ||
const plane & | cutPlane | ||
) | [static]
|
Track on surface to get closer to point. Possible situations:
2. reached edge (normal situation)
Definition at line 2886 of file triSurfaceTools.C.
References triangle< Point, PointRef >::EDGE, PrimitivePatch< Face, FaceList, PointField, PointType >::edgeFaces(), surfaceLocation::elementType(), PointIndexHit< Point >::hit(), PointIndexHit< Point >::index(), triangle< Point, PointRef >::NONE, pFaces, PrimitivePatch< Face, FaceList, PointField, PointType >::pointFaces(), PointIndexHit< Point >::rawPoint(), PointIndexHit< Point >::setMiss(), and surfaceLocation::triangle().
void track | ( | const triSurface & | s, |
const surfaceLocation & | endInfo, | ||
const plane & | cutPlane, | ||
surfaceLocation & | hitInfo | ||
) | [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 2964 of file triSurfaceTools.C.
References PointIndexHit< Point >::hit(), and surfaceLocation::triangle().
const Foam::label ANYEDGE = -1 [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.
const Foam::label NOEDGE = -2 [static]
|
Definition at line 368 of file triSurfaceTools.H.
const Foam::label COLLAPSED = -3 [static]
|
Definition at line 369 of file triSurfaceTools.H.