Foam::triIntersect Namespace Reference

Classes

class  location
 

Functions

template<class Type >
Ostreamoperator<< (Ostream &os, const FixedList< FixedList< Type, 3 >, 3 > &l)
 Print 3x3 FixedListLists on one line. More...
 
vector clipped01 (const vector x, const FixedList< label, 3 > groups)
 Clip the given vector between values of 0 and 1, and also clip one minus. More...
 
vector solveProjectionGivenT (const vector &C, const vector &Ct, const vector &Cu, const vector &Cv, const vector &Ctu, const vector &Ctv, const FixedList< label, 3 > groups, const scalar t)
 Solve a projection equation given a value of the t variable. More...
 
Tuple2< bool, vectorsolveProjection (const vector &C, const vector &Ct, const vector &Cu, const vector &Cv, const vector &Ctu, const vector &Ctv, const FixedList< label, 3 > groups)
 Solve a projection equation. More...
 
FixedList< FixedList< scalar, 3 >, 3 > srcTgtEdgeOffset (const FixedList< point, 3 > &srcPs, const FixedList< vector, 3 > &srcNs, const FixedList< bool, 3 > &srcOwns, const FixedList< point, 3 > &tgtPs, const FixedList< bool, 3 > &tgtOwns)
 Calculate the non-dimensional offsets of the source points from the target. More...
 
FixedList< FixedList< scalar, 3 >, 3 > tgtSrcEdgeOffset (const FixedList< point, 3 > &srcPs, const FixedList< vector, 3 > &srcNs, const FixedList< bool, 3 > &srcOwns, const FixedList< point, 3 > &tgtPs, const FixedList< bool, 3 > &tgtOwns)
 Calculate the non-dimensional offsets the target points from the source. More...
 
FixedList< FixedList< label, 3 >, 3 > thisInOtherEdge (const FixedList< FixedList< scalar, 3 >, 3 > &thisOtherEdgeOffset)
 Construct point-inside/outside-edge topology from a set of point-edge. More...
 
FixedList< label, 3 > thisInOtherTri (const FixedList< FixedList< label, 3 >, 3 > &thisInOtherEdge)
 Construct point-inside/outside-triangle topology from a set of. More...
 
FixedList< label, 3 > tgtInSrcTri (const FixedList< point, 3 > &srcPs, const FixedList< vector, 3 > &srcNs, const FixedList< point, 3 > &tgtPs, const FixedList< FixedList< label, 3 >, 3 > &tgtInSrcEdge)
 Construct target-point-inside/outside-source-triangle topology from a set. More...
 
void thisIsOther (const FixedList< label, 3 > &thisOtherPis, FixedList< FixedList< label, 3 >, 3 > &thisInOtherEdge, FixedList< label, 3 > &thisInOtherTri)
 Override results of the srcInTgt/tgtInSrc calculations with explicit. More...
 
void srcInTgt (const FixedList< point, 3 > &srcPs, const FixedList< vector, 3 > &srcNs, const FixedList< bool, 3 > &srcOwns, const FixedList< label, 3 > &srcTgtPis, const FixedList< point, 3 > &tgtPs, const FixedList< bool, 3 > &tgtOwns, FixedList< FixedList< label, 3 >, 3 > &srcInTgtEdge, FixedList< label, 3 > &srcInTgtTri)
 Calculate whether the points of the given source triangle project inside or. More...
 
void tgtInSrc (const FixedList< point, 3 > &srcPs, const FixedList< vector, 3 > &srcNs, const FixedList< bool, 3 > &srcOwns, const FixedList< point, 3 > &tgtPs, const FixedList< bool, 3 > &tgtOwns, const FixedList< label, 3 > &tgtSrcPis, FixedList< FixedList< label, 3 >, 3 > &tgtInSrcEdge, FixedList< label, 3 > &tgtInSrcTri)
 Calculate whether the points of the given target triangle project inside or. More...
 
bool orderLocations (const UList< location > &locations, bool isSrcEdge, const label i0, label &nVisited, boolList &visited, labelList &order)
 Order intersection locations into a polygon. More...
 
bool generateLocations (const FixedList< label, 3 > &tgtSrcPis, const FixedList< FixedList< label, 3 >, 3 > &srcInTgtEdge, const FixedList< FixedList< label, 3 >, 3 > &tgtInSrcEdge, const FixedList< label, 3 > &srcInTgtTri, const FixedList< label, 3 > &tgtInSrcTri, DynamicList< location > &pointLocations)
 Construct the intersection topology. More...
 
void generateGeometry (const FixedList< point, 3 > &srcPs, const FixedList< vector, 3 > &srcNs, const FixedList< point, 3 > &tgtPs, DynamicList< point > &srcPoints, DynamicList< vector > &srcPointNormals, DynamicList< point > &tgtPoints, const DynamicList< location > &pointLocations)
 Construct the intersection geometry. More...
 
template<class PointField >
void writePolygon (const word &name, const PointField &ps)
 Write a VTK file of a polygon. More...
 
void writeTriProjection (const word &name, const FixedList< point, 3 > &srcTriPs, const FixedList< vector, 3 > &srcTriNs, const label nEdge=20, const label nNormal=20, const scalar lNormal=0.5)
 Write a VTK file of a triangle projection. More...
 
scalar srcEdgeTgtPointOffset (const Pair< point > &srcPs, const Pair< vector > &srcNs, const point &tgtP)
 Calculate the signed offset of a target point in relation to a projected. More...
 
scalar srcEdgeTgtPointOffset (const Pair< point > &srcPs, const Pair< vector > &srcNs, const point &tgtP, const bool srcDirection)
 Calculate the signed offset of a target point in relation to a projected. More...
 
scalar srcPointTgtEdgeOffset (const point &srcP, const vector &srcN, const Pair< point > &tgtPs)
 Calculate the signed offset of a projected source point in relation to a. More...
 
scalar srcPointTgtEdgeOffset (const point &srcPs, const vector &srcNs, const Pair< point > &tgtP, const bool tgtDirection)
 Calculate the signed offset of a projected source point in relation to a. More...
 
Pair< scalar > srcEdgeTgtEdgeIntersection (const Pair< point > &srcPs, const Pair< vector > &srcNs, const Pair< point > &tgtPs)
 Calculate the intersection of a target edge with a source edge's. More...
 
barycentric2D srcTriTgtPointIntersection (const FixedList< point, 3 > &srcPs, const FixedList< vector, 3 > &srcNs, const point &tgtP)
 Calculate the intersection of a target point with a source triangle's. More...
 
template<class Type >
Type srcTriInterpolate (const barycentric2D &y, const FixedList< Type, 3 > &tgtPsis)
 Use the coordinates obtained from srcTriTgtPointIntersection to interpolate. More...
 
barycentric2D srcPointTgtTriIntersection (const point &srcP, const vector &srcN, const FixedList< point, 3 > &tgtPs)
 Calculate the intersection of a projected source point with a target. More...
 
template<class Type >
Type tgtTriInterpolate (const barycentric2D &y, const FixedList< Type, 3 > &tgtPsis)
 Use the coordinates obtained from srcPointTgtTriIntersection to interpolate. More...
 
void intersectTris (const FixedList< point, 3 > &srcPs, const FixedList< vector, 3 > &srcNs, const FixedList< bool, 3 > &srcOwns, const FixedList< label, 3 > &srcTgtPis, const FixedList< point, 3 > &tgtPs, const FixedList< bool, 3 > &tgtOwns, const FixedList< label, 3 > &tgtSrcPis, DynamicList< point > &srcPoints, DynamicList< vector > &srcPointNormals, DynamicList< point > &tgtPoints, DynamicList< location > &pointLocations, const bool debug, const word &writePrefix=word::null)
 Construct the intersection of a source triangle's projected volume and a. More...
 
bool operator== (const location &a, const location &b)
 
bool operator!= (const location &a, const location &b)
 
Ostreamoperator<< (Ostream &, const location &)
 

Variables

const scalar maxDot = - cos(degToRad(80))
 The maximum dot product between a source point normal and a target plane. More...
 

Function Documentation

◆ operator<<() [1/2]

Ostream& Foam::triIntersect::operator<< ( Ostream os,
const FixedList< FixedList< Type, 3 >, 3 > &  l 
)

Print 3x3 FixedListLists on one line.

Definition at line 49 of file triIntersect.C.

References token::BEGIN_LIST, token::END_LIST, forAll, and token::SPACE.

◆ clipped01()

vector Foam::triIntersect::clipped01 ( const vector  x,
const FixedList< label, 3 >  groups 
)

Clip the given vector between values of 0 and 1, and also clip one minus.

its component sum. Clipping is applied to groups of components. It is done by moving the value linearly towards the value where all components in the group, and one minus their sum, share the same value.

Definition at line 66 of file triIntersect.C.

Referenced by solveProjection(), and solveProjectionGivenT().

Here is the caller graph for this function:

◆ solveProjectionGivenT()

vector Foam::triIntersect::solveProjectionGivenT ( const vector C,
const vector Ct,
const vector Cu,
const vector Cv,
const vector Ctu,
const vector Ctv,
const FixedList< label, 3 >  groups,
const scalar  t 
)

Solve a projection equation given a value of the t variable.

Definition at line 137 of file triIntersect.C.

References Foam::saturationModels::A, Foam::saturationModels::B, clipped01(), Foam::cof(), Cv(), Foam::det(), Foam::protectedDivide(), Vector2D< Cmpt >::x(), and Vector2D< Cmpt >::y().

Referenced by solveProjection(), and srcTriTgtPointIntersection().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ solveProjection()

Tuple2<bool, vector> Foam::triIntersect::solveProjection ( const vector C,
const vector Ct,
const vector Cu,
const vector Cv,
const vector Ctu,
const vector Ctv,
const FixedList< label, 3 >  groups 
)

Solve a projection equation.

Definition at line 181 of file triIntersect.C.

References clipped01(), Foam::cmptMag(), Foam::cmptMax(), Foam::cmptSum(), Cv(), forAll, Foam::mag(), Foam::magSqr(), Foam::real, cubicEqn::roots(), solveProjectionGivenT(), Foam::Swap(), Roots< N >::type(), and VectorSpace< Form, Cmpt, Ncmpts >::uniform().

Referenced by srcEdgeTgtEdgeIntersection(), and srcTriTgtPointIntersection().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ srcTgtEdgeOffset()

FixedList<FixedList<scalar, 3>, 3> Foam::triIntersect::srcTgtEdgeOffset ( const FixedList< point, 3 > &  srcPs,
const FixedList< vector, 3 > &  srcNs,
const FixedList< bool, 3 > &  srcOwns,
const FixedList< point, 3 > &  tgtPs,
const FixedList< bool, 3 > &  tgtOwns 
)

Calculate the non-dimensional offsets of the source points from the target.

edges. These values are considered indicative only. The calculation is not as reliable as that for the target point offsets from the source edges (see below). The target point offsets should take precedence where possible.

Definition at line 285 of file triIntersect.C.

◆ tgtSrcEdgeOffset()

FixedList<FixedList<scalar, 3>, 3> Foam::triIntersect::tgtSrcEdgeOffset ( const FixedList< point, 3 > &  srcPs,
const FixedList< vector, 3 > &  srcNs,
const FixedList< bool, 3 > &  srcOwns,
const FixedList< point, 3 > &  tgtPs,
const FixedList< bool, 3 > &  tgtOwns 
)

Calculate the non-dimensional offsets the target points from the source.

edges. These values are considered definitive, and should take precedence over the source point target edge offsets.

Definition at line 380 of file triIntersect.C.

◆ thisInOtherEdge()

FixedList<FixedList<label, 3>, 3> Foam::triIntersect::thisInOtherEdge ( const FixedList< FixedList< scalar, 3 >, 3 > &  thisOtherEdgeOffset)

Construct point-inside/outside-edge topology from a set of point-edge.

offsets. Uses the sign of the offsets.

Definition at line 414 of file triIntersect.C.

◆ thisInOtherTri()

FixedList<label, 3> Foam::triIntersect::thisInOtherTri ( const FixedList< FixedList< label, 3 >, 3 > &  thisInOtherEdge)

Construct point-inside/outside-triangle topology from a set of.

point-inside/outside-edge topology

Definition at line 437 of file triIntersect.C.

◆ tgtInSrcTri()

FixedList<label, 3> Foam::triIntersect::tgtInSrcTri ( const FixedList< point, 3 > &  srcPs,
const FixedList< vector, 3 > &  srcNs,
const FixedList< point, 3 > &  tgtPs,
const FixedList< FixedList< label, 3 >, 3 > &  tgtInSrcEdge 
)

Construct target-point-inside/outside-source-triangle topology from a set.

of target-point-inside/outside-source-edge topology, and some additional geometric information to handle cases where the source normal direction is reversed relative to the target triangle

Definition at line 458 of file triIntersect.C.

Referenced by generateLocations(), and intersectTris().

Here is the caller graph for this function:

◆ thisIsOther()

void Foam::triIntersect::thisIsOther ( const FixedList< label, 3 > &  thisOtherPis,
FixedList< FixedList< label, 3 >, 3 > &  thisInOtherEdge,
FixedList< label, 3 > &  thisInOtherTri 
)

Override results of the srcInTgt/tgtInSrc calculations with explicit.

connections between points on either side

Definition at line 491 of file triIntersect.C.

◆ srcInTgt()

void Foam::triIntersect::srcInTgt ( const FixedList< point, 3 > &  srcPs,
const FixedList< vector, 3 > &  srcNs,
const FixedList< bool, 3 > &  srcOwns,
const FixedList< label, 3 > &  srcTgtPis,
const FixedList< point, 3 > &  tgtPs,
const FixedList< bool, 3 > &  tgtOwns,
FixedList< FixedList< label, 3 >, 3 > &  srcInTgtEdge,
FixedList< label, 3 > &  srcInTgtTri 
)

Calculate whether the points of the given source triangle project inside or.

outside the opposing target triangle and its edges

Definition at line 517 of file triIntersect.C.

Referenced by intersectTris().

Here is the caller graph for this function:

◆ tgtInSrc()

void Foam::triIntersect::tgtInSrc ( const FixedList< point, 3 > &  srcPs,
const FixedList< vector, 3 > &  srcNs,
const FixedList< bool, 3 > &  srcOwns,
const FixedList< point, 3 > &  tgtPs,
const FixedList< bool, 3 > &  tgtOwns,
const FixedList< label, 3 > &  tgtSrcPis,
FixedList< FixedList< label, 3 >, 3 > &  tgtInSrcEdge,
FixedList< label, 3 > &  tgtInSrcTri 
)

Calculate whether the points of the given target triangle project inside or.

outside the opposing source triangle and its edges

Definition at line 542 of file triIntersect.C.

Referenced by intersectTris().

Here is the caller graph for this function:

◆ orderLocations()

bool Foam::triIntersect::orderLocations ( const UList< location > &  locations,
bool  isSrcEdge,
const label  i0,
label nVisited,
boolList visited,
labelList order 
)

◆ generateLocations()

bool Foam::triIntersect::generateLocations ( const FixedList< label, 3 > &  tgtSrcPis,
const FixedList< FixedList< label, 3 >, 3 > &  srcInTgtEdge,
const FixedList< FixedList< label, 3 >, 3 > &  tgtInSrcEdge,
const FixedList< label, 3 > &  srcInTgtTri,
const FixedList< label, 3 > &  tgtInSrcTri,
DynamicList< location > &  pointLocations 
)

◆ generateGeometry()

void Foam::triIntersect::generateGeometry ( const FixedList< point, 3 > &  srcPs,
const FixedList< vector, 3 > &  srcNs,
const FixedList< point, 3 > &  tgtPs,
DynamicList< point > &  srcPoints,
DynamicList< vector > &  srcPointNormals,
DynamicList< point > &  tgtPoints,
const DynamicList< location > &  pointLocations 
)

◆ writePolygon()

void writePolygon ( const word name,
const PointField ps 
)

Write a VTK file of a polygon.

Definition at line 32 of file triIntersectTemplates.C.

References Foam::endl(), Foam::identityMap(), Foam::indent(), Foam::Info, Foam::name(), and Foam::vtkWriteOps::write().

Referenced by intersectTris().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeTriProjection()

void writeTriProjection ( const word name,
const FixedList< point, 3 > &  srcTriPs,
const FixedList< vector, 3 > &  srcTriNs,
const label  nEdge = 20,
const label  nNormal = 20,
const scalar  lNormal = 0.5 
)

Write a VTK file of a triangle projection.

Definition at line 1239 of file triIntersect.C.

References Foam::endl(), Foam::indent(), Foam::Info, Foam::mag(), Foam::max(), Foam::name(), u0, Foam::vtkWriteOps::write(), and x.

Referenced by intersectTris().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ srcEdgeTgtPointOffset() [1/2]

Foam::scalar srcEdgeTgtPointOffset ( const Pair< point > &  srcPs,
const Pair< vector > &  srcNs,
const point tgtP 
)

Calculate the signed offset of a target point in relation to a projected.

source edge

Definition at line 1310 of file triIntersect.C.

References Foam::saturationModels::A, Foam::det(), Foam::offset(), Foam::protectedDivideAndClip01(), Foam::T(), Vector< Cmpt >::x(), Vector< Cmpt >::y(), and Vector< Cmpt >::z().

Referenced by srcEdgeTgtEdgeIntersection(), srcEdgeTgtPointOffset(), and srcTriTgtPointIntersection().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ srcEdgeTgtPointOffset() [2/2]

Foam::scalar srcEdgeTgtPointOffset ( const Pair< point > &  srcPs,
const Pair< vector > &  srcNs,
const point tgtP,
const bool  srcDirection 
)

Calculate the signed offset of a target point in relation to a projected.

source edge. Additional ordering argument can be used to account for edge orientation and thereby guarantee consistency of the result.

Definition at line 1331 of file triIntersect.C.

References Foam::reverse(), and srcEdgeTgtPointOffset().

Here is the call graph for this function:

◆ srcPointTgtEdgeOffset() [1/2]

Foam::scalar srcPointTgtEdgeOffset ( const point srcP,
const vector srcN,
const Pair< point > &  tgtPs 
)

Calculate the signed offset of a projected source point in relation to a.

target edge

Definition at line 1350 of file triIntersect.C.

References Foam::saturationModels::A, Foam::det(), Foam::offset(), Foam::protectedDivide(), Foam::T(), and Vector< Cmpt >::z().

Referenced by srcPointTgtEdgeOffset().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ srcPointTgtEdgeOffset() [2/2]

Foam::scalar srcPointTgtEdgeOffset ( const point srcPs,
const vector srcNs,
const Pair< point > &  tgtP,
const bool  tgtDirection 
)

Calculate the signed offset of a projected source point in relation to a.

target edge. Additional ordering argument can be used to account for edge orientation and thereby guarantee consistency of the result.

Definition at line 1370 of file triIntersect.C.

References Foam::reverse(), and srcPointTgtEdgeOffset().

Here is the call graph for this function:

◆ srcEdgeTgtEdgeIntersection()

Foam::Pair< Foam::scalar > srcEdgeTgtEdgeIntersection ( const Pair< point > &  srcPs,
const Pair< vector > &  srcNs,
const Pair< point > &  tgtPs 
)

Calculate the intersection of a target edge with a source edge's.

projected surface. Return the local coordinates of the intersection along both the source and target edges.

Definition at line 1389 of file triIntersect.C.

References Foam::saturationModels::A, Foam::det(), UILList< LListBase, T >::first(), Foam::log2(), Foam::mag(), Foam::protectedDivideAndClip01(), s(), Foam::sign(), solveProjection(), srcEdgeTgtPointOffset(), and Foam::Zero.

Referenced by generateGeometry().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ srcTriTgtPointIntersection()

Foam::barycentric2D srcTriTgtPointIntersection ( const FixedList< point, 3 > &  srcPs,
const FixedList< vector, 3 > &  srcNs,
const point tgtP 
)

Calculate the intersection of a target point with a source triangle's.

projected volume. Return the local coordinates of the intersection within the source triangle.

Definition at line 1537 of file triIntersect.C.

References Foam::saturationModels::A, Foam::exit(), Foam::FatalError, FatalErrorInFunction, Foam::findMax(), Foam::findMin(), UILList< LListBase, T >::first(), forAll, Foam::log2(), Foam::offset(), Foam::protectedDivide(), Foam::sign(), solveProjection(), solveProjectionGivenT(), srcEdgeTgtPointOffset(), T0, and y.

Referenced by generateGeometry().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ srcTriInterpolate()

Type srcTriInterpolate ( const barycentric2D y,
const FixedList< Type, 3 > &  tgtPsis 
)

Use the coordinates obtained from srcTriTgtPointIntersection to interpolate.

a property within a source triangle's projected volume

Definition at line 53 of file triIntersectTemplates.C.

References Foam::findMax(), Foam::findMin(), and y.

Referenced by generateGeometry().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ srcPointTgtTriIntersection()

Foam::barycentric2D srcPointTgtTriIntersection ( const point srcP,
const vector srcN,
const FixedList< point, 3 > &  tgtPs 
)

Calculate the intersection of a projected source point with a target.

triangle. Return the local coordinates of the intersection within the target triangle.

Definition at line 1785 of file triIntersect.C.

References Foam::saturationModels::A, Foam::cmptMag(), Foam::cmptSum(), Foam::cof(), Foam::det(), Foam::findMax(), Foam::mag(), Foam::T(), T0, Vector2D< Cmpt >::x(), y, and Vector2D< Cmpt >::y().

Referenced by generateGeometry().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tgtTriInterpolate()

Type tgtTriInterpolate ( const barycentric2D y,
const FixedList< Type, 3 > &  tgtPsis 
)

Use the coordinates obtained from srcPointTgtTriIntersection to interpolate.

a property within a target triangle

Definition at line 86 of file triIntersectTemplates.C.

References y.

Referenced by generateGeometry().

Here is the caller graph for this function:

◆ intersectTris()

void intersectTris ( const FixedList< point, 3 > &  srcPs,
const FixedList< vector, 3 > &  srcNs,
const FixedList< bool, 3 > &  srcOwns,
const FixedList< label, 3 > &  srcTgtPis,
const FixedList< point, 3 > &  tgtPs,
const FixedList< bool, 3 > &  tgtOwns,
const FixedList< label, 3 > &  tgtSrcPis,
DynamicList< point > &  srcPoints,
DynamicList< vector > &  srcPointNormals,
DynamicList< point > &  tgtPoints,
DynamicList< location > &  pointLocations,
const bool  debug,
const word writePrefix = word::null 
)

Construct the intersection of a source triangle's projected volume and a.

target triangle

Definition at line 1848 of file triIntersect.C.

References Foam::count(), Foam::decrIndent(), Foam::endl(), generateGeometry(), generateLocations(), Foam::incrIndent(), Foam::indent(), Foam::Info, srcInTgt(), tgtInSrc(), tgtInSrcTri(), Foam::vtkWriteOps::write(), writePolygon(), and writeTriProjection().

Here is the call graph for this function:

◆ operator==()

bool operator== ( const location a,
const location b 
)
inline

Definition at line 190 of file triIntersectLocationI.H.

References b.

◆ operator!=()

bool operator!= ( const location a,
const location b 
)
inline

Definition at line 198 of file triIntersectLocationI.H.

References b.

◆ operator<<() [2/2]

Foam::Ostream & operator<< ( Ostream os,
const location l 
)

Definition at line 31 of file triIntersectLocationIO.C.

Variable Documentation

◆ maxDot

const scalar maxDot = - cos(degToRad(80))

The maximum dot product between a source point normal and a target plane.

considered to be a valid, forward projection

Definition at line 44 of file triIntersect.C.