triSurfaceTools Class Reference

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
 

Detailed Description

A collection of tools for triSurface.

Source files

Definition at line 63 of file triSurfaceTools.H.

Member Enumeration Documentation

◆ sideType

enum sideType

On which side of surface.

Enumerator
UNKNOWN 
INSIDE 
OUTSIDE 

Definition at line 437 of file triSurfaceTools.H.

Member Function Documentation

◆ writeOBJ() [1/2]

void writeOBJ ( const fileName fName,
const pointField pts 
)
static

Write pointField to OBJ format file.

Definition at line 1250 of file triSurfaceTools.C.

References Foam::endl(), forAll, Foam::Pout, List< T >::size(), Vector< Cmpt >::x(), Vector< Cmpt >::y(), and Vector< Cmpt >::z().

Here is the call graph for this function:

◆ writeOBJ() [2/2]

void writeOBJ ( const triSurface surf,
const fileName fName,
const boolList markedVerts 
)
static

Write vertex subset to OBJ format file.

Definition at line 1269 of file triSurfaceTools.C.

References Foam::endl(), forAll, PrimitivePatch< FaceList, PointField >::localPoints(), Foam::Pout, Vector< Cmpt >::x(), Vector< Cmpt >::y(), and Vector< Cmpt >::z().

Here is the call graph for this function:

◆ getVertexTriangles()

void getVertexTriangles ( const triSurface surf,
const label  edgeI,
labelList edgeTris 
)
static

◆ getVertexVertices()

Foam::labelList getVertexVertices ( const triSurface surf,
const edge e 
)
static

Get all vertices (local numbering) connected to vertices of edge.

Definition at line 1342 of file triSurfaceTools.C.

References Foam::e, PrimitivePatch< FaceList, PointField >::edges(), forAll, HashSet< Key, Hash >::insert(), PrimitivePatch< FaceList, PointField >::pointEdges(), and HashTable< T, Key, Hash >::toc().

Here is the call graph for this function:

◆ otherFace()

Foam::label otherFace ( const triSurface surf,
const label  facei,
const label  edgeI 
)
static

Get face connected to edge not facei.

Definition at line 1427 of file triSurfaceTools.C.

References PrimitivePatch< FaceList, PointField >::edgeFaces(), and List< T >::size().

Here is the call graph for this function:

◆ otherEdges()

void otherEdges ( const triSurface surf,
const label  facei,
const label  edgeI,
label e1,
label e2 
)
static

◆ otherVertices()

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 1484 of file triSurfaceTools.C.

References Foam::abort(), f(), Foam::FatalError, FatalErrorInFunction, and PrimitivePatch< FaceList, PointField >::localFaces().

Here is the call graph for this function:

◆ oppositeEdge()

Foam::label oppositeEdge ( const triSurface surf,
const label  facei,
const label  vertI 
)
static

Get edge opposite vertex (local numbering)

Definition at line 1519 of file triSurfaceTools.C.

References Foam::abort(), Foam::e, PrimitivePatch< FaceList, PointField >::edges(), PrimitivePatch< FaceList, PointField >::faceEdges(), Foam::FatalError, FatalErrorInFunction, and forAll.

Here is the call graph for this function:

◆ oppositeVertex()

Foam::label oppositeVertex ( const triSurface surf,
const label  facei,
const label  edgeI 
)
static

Get vertex (local numbering) opposite edge.

Definition at line 1549 of file triSurfaceTools.C.

References Foam::abort(), Foam::e, PrimitivePatch< FaceList, PointField >::edges(), f(), Foam::FatalError, FatalErrorInFunction, forAll, and PrimitivePatch< FaceList, PointField >::localFaces().

Here is the call graph for this function:

◆ getEdge()

Foam::label getEdge ( const triSurface surf,
const label  vert1I,
const label  vert2I 
)
static

Returns edge label connecting v1, v2 (local numbering)

Definition at line 1578 of file triSurfaceTools.C.

References Foam::e, PrimitivePatch< FaceList, PointField >::edges(), forAll, and PrimitivePatch< FaceList, PointField >::pointEdges().

Here is the call graph for this function:

◆ getTriangle()

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 1602 of file triSurfaceTools.C.

References Foam::abort(), PrimitivePatch< FaceList, PointField >::edgeFaces(), PrimitivePatch< FaceList, PointField >::faceEdges(), Foam::FatalError, FatalErrorInFunction, and forAll.

Here is the call graph for this function:

◆ collapseEdges() [1/2]

Foam::triSurface collapseEdges ( const triSurface surf,
const labelList collapsableEdges 
)
static

Create new triSurface by collapsing edges to edge mids.

Definition at line 1649 of file triSurfaceTools.C.

References Foam::e, PrimitivePatch< FaceList, PointField >::edges(), forAll, PrimitivePatch< FaceList, PointField >::localPoints(), PrimitivePatch< FaceList, PointField >::nEdges(), and List< T >::size().

Here is the call graph for this function:

◆ collapseEdges() [2/2]

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 1702 of file triSurfaceTools.C.

References Foam::abort(), b, Foam::constant::universal::c, Foam::e, PrimitivePatch< FaceList, PointField >::edgeFaces(), PrimitivePatch< FaceList, PointField >::edges(), Foam::endl(), f(), Foam::FatalError, FatalErrorInFunction, forAll, PrimitivePatch< FaceList, PointField >::localFaces(), PrimitivePatch< FaceList, PointField >::localPoints(), Foam::min(), PrimitivePatch< FaceList, PointField >::nEdges(), triSurface::patches(), List< T >::setSize(), and List< T >::size().

Here is the call graph for this function:

◆ greenRefine()

◆ redGreenRefine()

Foam::triSurface redGreenRefine ( const triSurface surf,
const labelList refineFaces 
)
static

Refine face by splitting all edges. Neighbouring face is.

greenRefine'd.

Definition at line 1864 of file triSurfaceTools.C.

References forAll, and List< T >::size().

Here is the call graph for this function:

◆ minEdge()

Foam::label minEdge ( const triSurface surf,
const labelList edgeIndices 
)
static

Returns element in edgeIndices with minimum length.

Definition at line 1975 of file triSurfaceTools.C.

References Foam::e, PrimitivePatch< FaceList, PointField >::edges(), forAll, PrimitivePatch< FaceList, PointField >::localPoints(), and Foam::mag().

Here is the call graph for this function:

◆ maxEdge()

Foam::label maxEdge ( const triSurface surf,
const labelList edgeIndices 
)
static

Returns element in edgeIndices with minimum length.

Definition at line 2005 of file triSurfaceTools.C.

References Foam::e, PrimitivePatch< FaceList, PointField >::edges(), forAll, PrimitivePatch< FaceList, PointField >::localPoints(), and Foam::mag().

Here is the call graph for this function:

◆ mergePoints()

Foam::triSurface mergePoints ( const triSurface surf,
const scalar  mergeTol 
)
static

◆ surfaceNormal()

Foam::vector surfaceNormal ( const triSurface surf,
const label  nearestFacei,
const point nearestPt 
)
static

◆ edgeSide()

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 2138 of file triSurfaceTools.C.

References PrimitivePatch< FaceList, PointField >::edgeFaces(), PrimitivePatch< FaceList, PointField >::faceNormals(), n, and List< T >::size().

Here is the call graph for this function:

◆ surfaceSide()

◆ triangulate() [1/2]

◆ triangulate() [2/2]

◆ triangulateFaceCentre()

◆ calcInterpolationWeights() [1/2]

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 2673 of file triSurfaceTools.C.

References triangle< Point, PointRef >::a(), triangle< Point, PointRef >::b(), triangle< Point, PointRef >::c(), Foam::mag(), Foam::max(), and p.

Here is the call graph for this function:

◆ calcInterpolationWeights() [2/2]

void calcInterpolationWeights ( const triSurface s,
const pointField samplePts,
List< FixedList< label, 3 >> &  verts,
List< FixedList< scalar, 3 >> &  weights 
)
static

◆ delaunay2D()

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 2608 of file triSurfaceTools.C.

References Foam::abort(), UList< T >::begin(), dtris2(), Foam::FatalError, FatalErrorInFunction, forAll, points, List< T >::setSize(), and List< T >::size().

Here is the call graph for this function:

◆ classify()

Foam::surfaceLocation classify ( const triSurface s,
const label  triI,
const point trianglePoint 
)
static

◆ trackToEdge()

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:

  • 1. reached endpoint
  • 2. reached edge (normal situation)
  • 3. reached end of surface (edge on single face) Input:
  • starting position+triangle/edge/point (so has to be on surface!)
  • (optional) previous position+triangle/edge/point to prevent going back. Set index (of triangle/edge/point) to -1 if not used.
  • end position+triangle/edge/point (so has to be on surface!)
  • plane to follow. Has to go through end point! Returns:
  • true if end point reached (situation 1)
  • new position+triangle/edge/point Caller has to check for situation 3 by checking that triangle() is not set.

Definition at line 2881 of file triSurfaceTools.C.

References triangle< Point, PointRef >::EDGE, surfaceLocation::elementType(), PointIndexHit< Point >::hit(), PointIndexHit< Point >::index(), triangle< Point, PointRef >::NONE, pFaces, PointIndexHit< Point >::rawPoint(), s(), PointIndexHit< Point >::setMiss(), and surfaceLocation::triangle().

Here is the call graph for this function:

◆ track()

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 2959 of file triSurfaceTools.C.

References PointIndexHit< Point >::hit(), s(), and surfaceLocation::triangle().

Here is the call graph for this function:

Member Data Documentation

◆ ANYEDGE

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.

◆ NOEDGE

const Foam::label NOEDGE = -2
static

Definition at line 368 of file triSurfaceTools.H.

◆ COLLAPSED

const Foam::label COLLAPSED = -3
static

Definition at line 369 of file triSurfaceTools.H.


The documentation for this class was generated from the following files: