Basic surface-surface intersection description. Constructed from two surfaces it creates a description of the intersection. More...
Public Member Functions | |
ClassName ("surfaceIntersection") | |
surfaceIntersection () | |
Construct null. More... | |
surfaceIntersection (const triSurface &surf1, const edgeIntersections &intersections1, const triSurface &surf2, const edgeIntersections &intersections2) | |
Construct from precalculated intersection information. More... | |
surfaceIntersection (const triSurfaceSearch &querySurf1, const triSurfaceSearch &querySurf2) | |
Construct from two surfaces. Does all its own cutting. More... | |
surfaceIntersection (const triSurfaceSearch &querySurf1) | |
Special: intersect surface with itself. Used to check for. More... | |
const pointField & | cutPoints () const |
const edgeList & | cutEdges () const |
const labelPairLookup & | facePairToVertex () const |
const labelPairLookup & | facePairToEdge () const |
const labelListList & | edgeCuts (const bool) const |
Access either surf1EdgeCuts (isFirstSurface = true) or. More... | |
const labelListList & | surf1EdgeCuts () const |
const labelListList & | surf2EdgeCuts () const |
Private Member Functions | |
void | writeIntersectedEdges (const triSurface &surf, const labelListList &edgeCutVerts, Ostream &os) const |
Debugging: Dump intersected edges to stream. More... | |
void | storeIntersection (const bool isFirstSurf, const labelList &facesA, const label faceB, DynamicList< edge > &, DynamicList< point > &) |
Update reference between faceA and faceB. Updates facePairToVertex_. More... | |
void | classifyHit (const triSurface &surf1, const scalarField &surf1PointTol, const triSurface &surf2, const bool isFirstSurf, const label edgeI, const scalar tolDim, const pointIndexHit &pHit, DynamicList< edge > &allCutEdges, DynamicList< point > &allCutPoints, List< DynamicList< label > > &surfEdgeCuts) |
Investigate pHit to whether is case of point hits point,. More... | |
void | doCutEdges (const triSurface &surf1, const triSurfaceSearch &querySurf2, const bool isFirstSurf, const bool isSelfIntersection, DynamicList< edge > &allCutEdges, DynamicList< point > &allCutPoints, List< DynamicList< label > > &surfEdgeCuts) |
Cut edges of surf1 with surface 2. More... | |
Static Private Member Functions | |
static void | writeOBJ (const point &pt, Ostream &os) |
Write point in obj format. More... | |
static void | writeOBJ (const List< point > &, const List< edge > &, Ostream &) |
Write points and edges in obj format. More... | |
template<class T > | |
static void | transfer (List< DynamicList< T > > &, List< List< T > > &) |
Transfer contents of List<DynamicList<..> > to List<List<..>> More... | |
static scalar | minEdgeLen (const triSurface &surf, const label pointI) |
Get minimum length of all edges connected to point. More... | |
static label | getEdge (const triSurface &surf, const label faceI, const label fp) |
Get edge label of edge between face vertices fp and fp+1. More... | |
static void | removeDuplicates (const labelList &map, labelList &labels) |
Remove duplicates from ordered dynamic list. Returns map from old. More... | |
static void | inlineRemap (const labelList &map, labelList &elems) |
Apply map to elements of a labelList. More... | |
static edgeList | filterEdges (const edgeList &, labelList &map) |
static labelList | filterLabels (const labelList &elems, labelList &map) |
Remove all duplicate elements. More... | |
static bool | excludeEdgeHit (const triSurface &surf, const label edgeI, const label faceI, const scalar tol) |
Do some checks if edge and face (resulting from hit) More... | |
static label | classify (const scalar startTol, const scalar endTol, const point &p, const edge &e, const pointField &points) |
Detect if point close to edge of end. Returns -1: not close. More... | |
Private Attributes | |
pointField | cutPoints_ |
Newly introduced points. More... | |
edgeList | cutEdges_ |
Newly introduced edges (are on both surfaces). Reference into. More... | |
labelPairLookup | facePairToVertex_ |
From face on surf1 and face on surf2 to intersection point. More... | |
labelPairLookup | facePairToEdge_ |
From face on surf1 and face on surf2 to intersection edge. More... | |
labelListList | surf1EdgeCuts_ |
Edges on surf1 that are cut. From edge on surf1 to label in cutPoint. More... | |
labelListList | surf2EdgeCuts_ |
Edges on surf2 that are cut. From edge on surf2 to label in cutPoint. More... | |
Basic surface-surface intersection description. Constructed from two surfaces it creates a description of the intersection.
The intersection information consists of the intersection line(s) with new points, new edges between points (note that these edges and points are on both surfaces) and various addressing from original surface faces/edges to intersection and vice versa.
Gets either precalculated intersection information or calculates it itself. Algorithm works by intersecting all edges of one surface with the other surface and storing a reference from both faces (one on surface1, one on surface 2) to the vertex. If the reference re-occurs we have the second hit of both faces and an edge is created between the retrieved vertex and the new one.
Note: when doing intersecting itself uses intersection::planarTol() as a fraction of current edge length to determine if intersection is a point-touching one instead of an edge-piercing action.
Definition at line 80 of file surfaceIntersection.H.
Construct null.
Definition at line 699 of file surfaceIntersection.C.
surfaceIntersection | ( | const triSurface & | surf1, |
const edgeIntersections & | intersections1, | ||
const triSurface & | surf2, | ||
const edgeIntersections & | intersections2 | ||
) |
Construct from precalculated intersection information.
Advantage: intersection information is guaranteed to have no degenerate cuts.
Definition at line 815 of file surfaceIntersection.C.
References List::append(), DynamicList::append(), Foam::e, PrimitivePatch< Face, FaceList, PointField, PointType >::edgeFaces(), Foam::endl(), forAll, forAllConstIter(), HashTable::found(), PointIndexHit< Point >::hitPoint(), PointIndexHit< Point >::index(), HashSet< Key, Hash >::insert(), PrimitivePatch< Face, FaceList, PointField, PointType >::nEdges(), PrimitivePatch< Face, FaceList, PointField, PointType >::nPoints(), Foam::Pout, WarningInFunction, and writeOBJ().
surfaceIntersection | ( | const triSurfaceSearch & | querySurf1, |
const triSurfaceSearch & | querySurf2 | ||
) |
Construct from two surfaces. Does all its own cutting.
Has problems with degenerate cuts
Definition at line 712 of file surfaceIntersection.C.
References Foam::endl(), PrimitivePatch< Face, FaceList, PointField, PointType >::nEdges(), PrimitivePatch< Face, FaceList, PointField, PointType >::nPoints(), Foam::Pout, triSurfaceSearch::surface(), and writeOBJ().
surfaceIntersection | ( | const triSurfaceSearch & | querySurf1 | ) |
Special: intersect surface with itself. Used to check for.
self-intersection.
Definition at line 978 of file surfaceIntersection.C.
References Foam::e, PrimitivePatch< Face, FaceList, PointField, PointType >::edges(), Foam::endl(), forAll, PrimitivePatch< Face, FaceList, PointField, PointType >::localPoints(), Foam::mergePoints(), Foam::min(), PrimitivePatch< Face, FaceList, PointField, PointType >::nEdges(), intersection::planarTol(), Foam::Pout, triSurfaceSearch::surface(), and writeOBJ().
Write point in obj format.
Definition at line 37 of file surfaceIntersectionFuncs.C.
References Foam::endl(), Vector< Cmpt >::x(), Vector< Cmpt >::y(), and Vector< Cmpt >::z().
Write points and edges in obj format.
Definition at line 44 of file surfaceIntersectionFuncs.C.
References Foam::e, Foam::endl(), forAll, and writeOBJ().
Transfer contents of List<DynamicList<..> > to List<List<..>>
Definition at line 33 of file surfaceIntersectionTemplates.C.
References forAll.
|
staticprivate |
Get minimum length of all edges connected to point.
Definition at line 65 of file surfaceIntersectionFuncs.C.
References Foam::e, PrimitivePatch< Face, FaceList, PointField, PointType >::edges(), forAll, PrimitivePatch< Face, FaceList, PointField, PointType >::localPoints(), Foam::min(), and PrimitivePatch< Face, FaceList, PointField, PointType >::pointEdges().
|
staticprivate |
Get edge label of edge between face vertices fp and fp+1.
Definition at line 87 of file surfaceIntersectionFuncs.C.
References Foam::abort(), PrimitivePatch< Face, FaceList, PointField, PointType >::edges(), PrimitivePatch< Face, FaceList, PointField, PointType >::faceEdges(), Foam::FatalError, FatalErrorInFunction, forAll, and PrimitivePatch< Face, FaceList, PointField, PointType >::localFaces().
Remove duplicates from ordered dynamic list. Returns map from old.
to new (-1 if element removed)
Definition at line 118 of file surfaceIntersectionFuncs.C.
References forAll, and List::setSize().
Apply map to elements of a labelList.
Definition at line 167 of file surfaceIntersectionFuncs.C.
References forAll.
|
staticprivate |
Definition at line 182 of file surfaceIntersectionFuncs.C.
References Foam::e, HashTable< nil, word, string::hash >::find(), forAll, HashSet< Key, Hash >::insert(), List::setSize(), and List::size().
|
staticprivate |
Remove all duplicate elements.
Definition at line 223 of file surfaceIntersectionFuncs.C.
References HashTable::find(), forAll, HashSet< Key, Hash >::insert(), List::setSize(), and List::size().
|
staticprivate |
Do some checks if edge and face (resulting from hit)
should not be considered. Returns true if can be discarded.
Definition at line 52 of file surfaceIntersection.C.
References Foam::constant::electromagnetic::e, PrimitivePatch< Face, FaceList, PointField, PointType >::edges(), f(), forAll, and PrimitivePatch< Face, FaceList, PointField, PointType >::localFaces().
|
private |
Debugging: Dump intersected edges to stream.
Definition at line 259 of file surfaceIntersectionFuncs.C.
References Foam::e, PrimitivePatch< Face, FaceList, PointField, PointType >::edges(), Foam::endl(), forAll, PrimitivePatch< Face, FaceList, PointField, PointType >::localPoints(), PrimitivePatch< Face, FaceList, PointField, PointType >::nPoints(), List::size(), and writeOBJ().
|
staticprivate |
Detect if point close to edge of end. Returns -1: not close.
0:close (within startTol) to start, 1:close (within endTol) to end
Definition at line 304 of file surfaceIntersectionFuncs.C.
References Foam::e, Foam::mag(), p, and points.
|
private |
Update reference between faceA and faceB. Updates facePairToVertex_.
(first occurrence of face pair) and facePairToEdge_ (second occ.)
Definition at line 197 of file surfaceIntersection.C.
References DynamicList::append(), Foam::endl(), forAll, Foam::mag(), and WarningInFunction.
|
private |
Investigate pHit to whether is case of point hits point,.
point hits edge, point hits face or edge hits face.
Definition at line 274 of file surfaceIntersection.C.
References DynamicList::append(), Foam::constant::electromagnetic::e, PrimitivePatch< Face, FaceList, PointField, PointType >::edgeFaces(), PrimitivePatch< Face, FaceList, PointField, PointType >::edges(), edge::end(), Foam::endl(), PrimitivePatch< Face, FaceList, PointField, PointType >::faceNormals(), forAll, PointIndexHit< Point >::hitPoint(), PointIndexHit< Point >::index(), PrimitivePatch< Face, FaceList, PointField, PointType >::localFaces(), PrimitivePatch< Face, FaceList, PointField, PointType >::localPoints(), triFace::nearestPointClassify(), PrimitivePatch< Face, FaceList, PointField, PointType >::pointFaces(), Foam::Pout, and edge::start().
|
private |
Cut edges of surf1 with surface 2.
Definition at line 558 of file surfaceIntersection.C.
References DynamicList::append(), Foam::constant::electromagnetic::e, PrimitivePatch< Face, FaceList, PointField, PointType >::edges(), Foam::endl(), forAll, PointIndexHit< Point >::hit(), PointIndexHit< Point >::hitPoint(), PointIndexHit< Point >::index(), PrimitivePatch< Face, FaceList, PointField, PointType >::localPoints(), Foam::mag(), Foam::Pout, triSurfaceSearch::surface(), and triSurfaceSearch::tree().
ClassName | ( | "surfaceIntersection" | ) |
const Foam::pointField & cutPoints | ( | ) | const |
Definition at line 1132 of file surfaceIntersection.C.
Referenced by edgeSurface::edgeSurface(), and intersectedSurface::intersectedSurface().
const Foam::edgeList & cutEdges | ( | ) | const |
Definition at line 1138 of file surfaceIntersection.C.
Referenced by edgeSurface::edgeSurface(), and intersectedSurface::intersectedSurface().
const Foam::labelPairLookup & facePairToVertex | ( | ) | const |
Definition at line 1144 of file surfaceIntersection.C.
const Foam::labelPairLookup & facePairToEdge | ( | ) | const |
Definition at line 1150 of file surfaceIntersection.C.
Referenced by edgeSurface::edgeSurface().
const Foam::labelListList & edgeCuts | ( | const bool | isFirstSurf | ) | const |
Access either surf1EdgeCuts (isFirstSurface = true) or.
surf2EdgeCuts
Definition at line 1157 of file surfaceIntersection.C.
Referenced by edgeSurface::edgeSurface().
const Foam::labelListList & surf1EdgeCuts | ( | ) | const |
Definition at line 1172 of file surfaceIntersection.C.
const Foam::labelListList & surf2EdgeCuts | ( | ) | const |
Definition at line 1178 of file surfaceIntersection.C.
|
private |
Newly introduced points.
Definition at line 85 of file surfaceIntersection.H.
|
private |
Newly introduced edges (are on both surfaces). Reference into.
cutPoints.
Definition at line 89 of file surfaceIntersection.H.
|
private |
From face on surf1 and face on surf2 to intersection point.
(label in cutPoints)
Definition at line 93 of file surfaceIntersection.H.
|
private |
From face on surf1 and face on surf2 to intersection edge.
(label in cutEdges)
Definition at line 97 of file surfaceIntersection.H.
|
private |
Edges on surf1 that are cut. From edge on surf1 to label in cutPoint.
If multiple cuts:sorted from edge.start to edge.end
Definition at line 101 of file surfaceIntersection.H.
|
private |
Edges on surf2 that are cut. From edge on surf2 to label in cutPoint.
If multiple cuts:sorted from edge.start to edge.end
Definition at line 105 of file surfaceIntersection.H.
Copyright © 2011-2018 OpenFOAM | OPENFOAM® is a registered trademark of OpenCFD Ltd.