Holds feature edges/points of surface. More...
Public Types | |
enum | edgeStatus { NONE , REGION , EXTERNAL , INTERNAL } |
Edge status. More... | |
Public Member Functions | |
ClassName ("surfaceFeatures") | |
surfaceFeatures (const triSurface &surf) | |
Construct from surface. More... | |
surfaceFeatures (const triSurface &surf, const labelList &featurePoints, const labelList &featureEdges, const label externalStart, const label internalStart) | |
Construct from components. More... | |
surfaceFeatures (const triSurface &surf, const scalar includedAngle, const scalar minLen=0, const label minElems=0, const bool geometricTestOnly=false) | |
Construct from surface, angle and min cumulative length and/or. More... | |
surfaceFeatures (const triSurface &surf, const dictionary &dict) | |
Construct from dictionary. More... | |
surfaceFeatures (const triSurface &surf, const fileName &fName) | |
Construct from file. More... | |
surfaceFeatures (const triSurface &surf, const pointField &points, const edgeList &edges, const scalar mergeTol=1e-6, const bool geometricTestOnly=false) | |
Construct from pointField and edgeList (edgeMesh) More... | |
surfaceFeatures (const surfaceFeatures &sf) | |
Construct as copy. More... | |
const triSurface & | surface () const |
const labelList & | featurePoints () const |
Return feature point list. More... | |
const labelList & | featureEdges () const |
Return feature edge list. More... | |
label | externalStart () const |
Start of external edges. More... | |
label | internalStart () const |
Start of internal edges. More... | |
label | nRegionEdges () const |
Return number of region edges. More... | |
label | nExternalEdges () const |
Return number of external edges. More... | |
label | nInternalEdges () const |
Return number of internal edges. More... | |
labelList | selectFeatureEdges (const bool regionEdges, const bool externalEdges, const bool internalEdges) const |
Helper function: select a subset of featureEdges_. More... | |
void | findFeatures (const scalar includedAngle, const bool geometricTestOnly) |
Find feature edges using provided included angle. More... | |
labelList | trimFeatures (const scalar minLen, const label minElems, const scalar includedAngle) |
Delete small sets of edges. Edges are stringed up and any. More... | |
void | excludeBox (List< edgeStatus > &edgeStat, const treeBoundBox &bb) const |
Mark edge status inside box as 'NONE'. More... | |
void | subsetBox (List< edgeStatus > &edgeStat, const treeBoundBox &bb) const |
Mark edge status outside box as 'NONE'. More... | |
void | deleteBox (List< edgeStatus > &edgeStat, const treeBoundBox &bb, const bool removeInside) const |
Mark edge status as 'NONE' for edges inside/outside box. More... | |
void | subsetPlane (List< edgeStatus > &edgeStat, const plane &cutPlane) const |
If edge does not intersect the plane, mark as 'NONE'. More... | |
void | excludeOpen (List< edgeStatus > &edgeStat) const |
Mark edges with a single connected face as 'NONE'. More... | |
void | checkFlatRegionEdge (List< edgeStatus > &edgeStat, const scalar tol, const scalar includedAngle) const |
Divide into multiple normal bins. More... | |
List< edgeStatus > | toStatus () const |
From member feature edges to status per edge. More... | |
void | setFromStatus (const List< edgeStatus > &edgeStat, const scalar includedAngle) |
Set from status per edge. More... | |
Map< label > | nearestSamples (const labelList &selectedPoints, const pointField &samples, const scalarField &maxDistSqr) const |
Find nearest sample for selected surface points. More... | |
Map< label > | nearestSamples (const labelList &selectedEdges, const pointField &samples, const scalarField &sampleDist, const scalarField &maxDistSqr, const scalar minSampleDist=0.1) const |
Find nearest sample for regularly sampled points along. More... | |
Map< pointIndexHit > | nearestEdges (const labelList &selectedEdges, const edgeList &sampleEdges, const labelList &selectedSampleEdges, const pointField &samplePoints, const scalarField &sampleDist, const scalarField &maxDistSqr, const scalar minSampleDist=0.1) const |
Like nearestSamples but now gets nearest point on. More... | |
void | nearestSurfEdge (const labelList &selectedEdges, const pointField &samples, scalar searchSpanSqr, labelList &edgeLabel, labelList &edgeEndPoint, pointField &edgePoint) const |
Find nearest surface edge (out of selectedEdges) for. More... | |
void | nearestSurfEdge (const labelList &selectedEdges, const edgeList &sampleEdges, const labelList &selectedSampleEdges, const pointField &samplePoints, const vector &searchSpan, labelList &edgeLabel, pointField &pointOnEdge, pointField &pointOnFeature) const |
Find nearest surface edge (out of selectedEdges) for each. More... | |
void | nearestFeatEdge (const edgeList &edges, const pointField &points, scalar searchSpanSqr, labelList &edgeLabel) const |
Find nearest feature edge to each surface edge. Uses the. More... | |
void | writeDict (Ostream &os) const |
Write as dictionary. More... | |
void | write (const fileName &fName) const |
Write as dictionary to file. More... | |
void | writeObj (const fileName &prefix) const |
Write to separate OBJ files (region, external, internal edges,. More... | |
void | writeStats (Ostream &os) const |
Write some information. More... | |
void | operator= (const surfaceFeatures &rhs) |
Holds feature edges/points of surface.
Feature edges are stored in one list and sorted: 0 .. externalStart_-1 : region edges externalStart_ .. internalStart_-1 : external edges internalStart_ .. size-1 : internal edges
NOTE: angle is included angle, not feature angle and is in degrees. The included angle is the smallest angle between two planes. For coplanar faces it is 180, for straight angles it is 90. To pick up straight edges only use included angle of 91 degrees
Definition at line 73 of file surfaceFeatures.H.
enum edgeStatus |
Edge status.
Enumerator | |
---|---|
NONE | Not a classified feature edge. |
REGION | |
EXTERNAL | "Convex" edge |
INTERNAL | "Concave" edge |
Definition at line 78 of file surfaceFeatures.H.
surfaceFeatures | ( | const triSurface & | surf | ) |
Construct from surface.
Definition at line 651 of file surfaceFeatures.C.
surfaceFeatures | ( | const triSurface & | surf, |
const labelList & | featurePoints, | ||
const labelList & | featureEdges, | ||
const label | externalStart, | ||
const label | internalStart | ||
) |
Construct from components.
Definition at line 662 of file surfaceFeatures.C.
surfaceFeatures | ( | const triSurface & | surf, |
const scalar | includedAngle, | ||
const scalar | minLen = 0 , |
||
const label | minElems = 0 , |
||
const bool | geometricTestOnly = false |
||
) |
Construct from surface, angle and min cumulative length and/or.
number of elements. If geometric test only is true, then region information is ignored and features are only assigned based on the geometric criteria
Definition at line 680 of file surfaceFeatures.C.
References surfaceFeatures::findFeatures(), and surfaceFeatures::trimFeatures().
surfaceFeatures | ( | const triSurface & | surf, |
const dictionary & | dict | ||
) |
Construct from dictionary.
Definition at line 704 of file surfaceFeatures.C.
surfaceFeatures | ( | const triSurface & | surf, |
const fileName & | fName | ||
) |
Construct from file.
Definition at line 718 of file surfaceFeatures.C.
References dictionary::readEntry().
surfaceFeatures | ( | const triSurface & | surf, |
const pointField & | points, | ||
const edgeList & | edges, | ||
const scalar | mergeTol = 1e-6 , |
||
const bool | geometricTestOnly = false |
||
) |
Construct from pointField and edgeList (edgeMesh)
Definition at line 741 of file surfaceFeatures.C.
References DynamicList< T, SizeMin >::append(), HashTable< T, Key, Hash >::cfind(), HashTable< T, Key, Hash >::clear(), List< T >::clear(), PrimitivePatch< FaceList, PointField >::edgeFaces(), PrimitivePatch< FaceList, PointField >::edges(), forAll, HashTable< T, Key, Hash >::insert(), surfaceFeatures::nearestFeatEdge(), PrimitivePatch< FaceList, PointField >::nEdges(), surfaceFeatures::NONE, points, surfaceFeatures::setFromStatus(), HashTable< T, Key, Hash >::size(), UList< T >::size(), and Foam::sqr().
surfaceFeatures | ( | const surfaceFeatures & | sf | ) |
Construct as copy.
Definition at line 822 of file surfaceFeatures.C.
ClassName | ( | "surfaceFeatures" | ) |
|
inline |
Definition at line 244 of file surfaceFeatures.H.
Referenced by extendedEdgeMesh::extendedEdgeMesh(), and surfaceFeatures::operator=().
|
inline |
Return feature point list.
Definition at line 250 of file surfaceFeatures.H.
Referenced by extendedEdgeMesh::extendedEdgeMesh(), and surfaceFeatures::operator=().
|
inline |
Return feature edge list.
Definition at line 256 of file surfaceFeatures.H.
Referenced by extendedEdgeMesh::extendedEdgeMesh(), and surfaceFeatures::operator=().
|
inline |
Start of external edges.
Definition at line 262 of file surfaceFeatures.H.
Referenced by surfaceFeatures::operator=().
|
inline |
Start of internal edges.
Definition at line 268 of file surfaceFeatures.H.
Referenced by surfaceFeatures::operator=().
|
inline |
Return number of region edges.
Definition at line 274 of file surfaceFeatures.H.
Referenced by extendedEdgeMesh::extendedEdgeMesh().
|
inline |
Return number of external edges.
Definition at line 280 of file surfaceFeatures.H.
|
inline |
Return number of internal edges.
Definition at line 286 of file surfaceFeatures.H.
Foam::labelList selectFeatureEdges | ( | const bool | regionEdges, |
const bool | externalEdges, | ||
const bool | internalEdges | ||
) | const |
Helper function: select a subset of featureEdges_.
Definition at line 834 of file surfaceFeatures.C.
References DynamicList< T, SizeMin >::append(), DynamicList< T, SizeMin >::setCapacity(), DynamicList< T, SizeMin >::shrink(), and UList< T >::size().
void findFeatures | ( | const scalar | includedAngle, |
const bool | geometricTestOnly | ||
) |
Find feature edges using provided included angle.
Definition at line 877 of file surfaceFeatures.C.
References Foam::cos(), and Foam::degToRad().
Referenced by surfaceFeatures::surfaceFeatures().
Foam::labelList trimFeatures | ( | const scalar | minLen, |
const label | minElems, | ||
const scalar | includedAngle | ||
) |
Delete small sets of edges. Edges are stringed up and any.
string of length < minLen (or nElems < minElems) is deleted.
Definition at line 902 of file surfaceFeatures.C.
References forAll, edge::mag(), and UList< T >::size().
Referenced by surfaceFeatures::surfaceFeatures().
void excludeBox | ( | List< edgeStatus > & | edgeStat, |
const treeBoundBox & | bb | ||
) | const |
Mark edge status inside box as 'NONE'.
Definition at line 1036 of file surfaceFeatures.C.
void subsetBox | ( | List< edgeStatus > & | edgeStat, |
const treeBoundBox & | bb | ||
) | const |
Mark edge status outside box as 'NONE'.
Definition at line 1046 of file surfaceFeatures.C.
void deleteBox | ( | List< edgeStatus > & | edgeStat, |
const treeBoundBox & | bb, | ||
const bool | removeInside | ||
) | const |
Mark edge status as 'NONE' for edges inside/outside box.
Definition at line 1056 of file surfaceFeatures.C.
References treeBoundBox::contains(), forAll, and surfaceFeatures::NONE.
void subsetPlane | ( | List< edgeStatus > & | edgeStat, |
const plane & | cutPlane | ||
) | const |
If edge does not intersect the plane, mark as 'NONE'.
Definition at line 1078 of file surfaceFeatures.C.
References e, UList< T >::end(), forAll, plane::lineIntersect(), surfaceFeatures::NONE, and p0.
void excludeOpen | ( | List< edgeStatus > & | edgeStat | ) | const |
Mark edges with a single connected face as 'NONE'.
Definition at line 1109 of file surfaceFeatures.C.
References forAll, and surfaceFeatures::NONE.
void checkFlatRegionEdge | ( | List< edgeStatus > & | edgeStat, |
const scalar | tol, | ||
const scalar | includedAngle | ||
) | const |
Divide into multiple normal bins.
set REGION if 2 normals that make feature angle
Definition at line 1128 of file surfaceFeatures.C.
Foam::List< Foam::surfaceFeatures::edgeStatus > toStatus | ( | ) | const |
From member feature edges to status per edge.
Definition at line 117 of file surfaceFeatures.C.
void setFromStatus | ( | const List< edgeStatus > & | edgeStat, |
const scalar | includedAngle | ||
) |
Set from status per edge.
Definition at line 145 of file surfaceFeatures.C.
References Foam::cos(), Foam::degToRad(), and forAll.
Referenced by surfaceFeatures::surfaceFeatures().
Foam::Map< Foam::label > nearestSamples | ( | const labelList & | selectedPoints, |
const pointField & | samples, | ||
const scalarField & | maxDistSqr | ||
) | const |
Find nearest sample for selected surface points.
(usually the set of featurePoints). Return map from index in samples to surface point. Do not include points that are further than maxDist away (separate maxDist for every sample). Supply maxDistSqr.
Definition at line 1239 of file surfaceFeatures.C.
References Foam::abort(), indexedOctree< Type >::bb(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, forAll, forAllConstIters, PointIndexHit< PointType >::hit(), PointIndexHit< PointType >::index(), HashTable< T, Key, Hash >::insert(), Foam::magSqr(), pointLabels(), Foam::Pout, samples(), UList< T >::size(), and Foam::meshTools::writeOBJ().
Foam::Map< Foam::label > nearestSamples | ( | const labelList & | selectedEdges, |
const pointField & | samples, | ||
const scalarField & | sampleDist, | ||
const scalarField & | maxDistSqr, | ||
const scalar | minSampleDist = 0.1 |
||
) | const |
Find nearest sample for regularly sampled points along.
the selected (surface) edges. Return map from sample to edge. maxDistSqr is distance squared below which gets snapped. Edge gets sampled at points sampleDist[sampleI] apart. (with a maximum of 10 samples per edge)
Definition at line 1320 of file surfaceFeatures.C.
References e, Foam::endl(), Foam::exit(), forAll, forAllConstIters, PointIndexHit< PointType >::hit(), PointIndexHit< PointType >::hitPoint(), PointIndexHit< PointType >::index(), HashTable< T, Key, Hash >::insert(), Foam::mag(), Foam::magSqr(), Foam::max(), Foam::Pout, s(), samples(), UList< T >::size(), and Foam::meshTools::writeOBJ().
Foam::Map< Foam::pointIndexHit > nearestEdges | ( | const labelList & | selectedEdges, |
const edgeList & | sampleEdges, | ||
const labelList & | selectedSampleEdges, | ||
const pointField & | samplePoints, | ||
const scalarField & | sampleDist, | ||
const scalarField & | maxDistSqr, | ||
const scalar | minSampleDist = 0.1 |
||
) | const |
Like nearestSamples but now gets nearest point on.
sample-edge instead of nearest sample-point itself. Return map from sample edge to feature edge.
Definition at line 1456 of file surfaceFeatures.C.
References edge::centre(), e, Foam::endl(), Foam::exit(), forAll, forAllConstIters, PointIndexHit< PointType >::hit(), PointIndexHit< PointType >::hitPoint(), PointIndexHit< PointType >::index(), HashTable< T, Key, Hash >::insert(), Foam::mag(), Foam::magSqr(), Foam::max(), Foam::Pout, s(), indexedOctree< Type >::shapes(), UList< T >::size(), and Foam::meshTools::writeOBJ().
void nearestSurfEdge | ( | const labelList & | selectedEdges, |
const pointField & | samples, | ||
scalar | searchSpanSqr, | ||
labelList & | edgeLabel, | ||
labelList & | edgeEndPoint, | ||
pointField & | edgePoint | ||
) | const |
Find nearest surface edge (out of selectedEdges) for.
each sample point. Sets:
Definition at line 1607 of file surfaceFeatures.C.
References e, UList< T >::end(), forAll, PointIndexHit< PointType >::hit(), PointIndexHit< PointType >::index(), boundBox::inflate(), PointIndexHit< PointType >::rawPoint(), samples(), List< T >::setSize(), and UList< T >::size().
void nearestSurfEdge | ( | const labelList & | selectedEdges, |
const edgeList & | sampleEdges, | ||
const labelList & | selectedSampleEdges, | ||
const pointField & | samplePoints, | ||
const vector & | searchSpan, | ||
labelList & | edgeLabel, | ||
pointField & | pointOnEdge, | ||
pointField & | pointOnFeature | ||
) | const |
Find nearest surface edge (out of selectedEdges) for each.
sample edge. Sets:
Definition at line 1677 of file surfaceFeatures.C.
References line< Point, PointRef >::centre(), e, forAll, PointIndexHit< PointType >::hit(), PointIndexHit< PointType >::hitPoint(), PointIndexHit< PointType >::index(), List< T >::setSize(), and UList< T >::size().
void nearestFeatEdge | ( | const edgeList & | edges, |
const pointField & | points, | ||
scalar | searchSpanSqr, | ||
labelList & | edgeLabel | ||
) | const |
Find nearest feature edge to each surface edge. Uses the.
mid-point of the surface edges.
Definition at line 1743 of file surfaceFeatures.C.
References forAll, PointIndexHit< PointType >::hit(), Foam::identity(), PointIndexHit< PointType >::index(), boundBox::inflate(), Foam::mag(), points, UList< T >::size(), and edge::vec().
Referenced by surfaceFeatures::surfaceFeatures().
void writeDict | ( | Ostream & | os | ) | const |
Write as dictionary.
Definition at line 1155 of file surfaceFeatures.C.
References dictionary::add(), os(), and dictionary::write().
void write | ( | const fileName & | fName | ) | const |
Write as dictionary to file.
Definition at line 1167 of file surfaceFeatures.C.
References os().
void writeObj | ( | const fileName & | prefix | ) | const |
Write to separate OBJ files (region, external, internal edges,.
feature points) for visualization
Definition at line 1174 of file surfaceFeatures.C.
References e, Foam::endl(), OFstream::name(), Foam::Pout, and Foam::meshTools::writeOBJ().
void writeStats | ( | Ostream & | os | ) | const |
Write some information.
Definition at line 1226 of file surfaceFeatures.C.
References Foam::endl(), Foam::nl, and os().
void operator= | ( | const surfaceFeatures & | rhs | ) |
Definition at line 1806 of file surfaceFeatures.C.
References Foam::abort(), surfaceFeatures::externalStart(), Foam::FatalError, FatalErrorInFunction, surfaceFeatures::featureEdges(), surfaceFeatures::featurePoints(), surfaceFeatures::internalStart(), and surfaceFeatures::surface().