Foam::triIntersect Namespace Reference

Classes

class  location
 

Functions

scalar protectedDivide (const scalar a, const scalar b)
 Divide two numbers and protect the result from overflowing. More...
 
scalar protectedDivideAndClip01 (const scalar a, const scalar b)
 Divide two numbers, protect the result from overflowing, and clip the. More...
 
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...
 
void srcInTgt (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, 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, FixedList< FixedList< label, 3 >, 3 > &tgtInSrcEdge, FixedList< label, 3 > &tgtInSrcTri)
 Calculate whether the points of the given target triangle project inside or. 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...
 
bool orderLocations (const UList< location > &locations, bool isSrcEdge, const label i0, label &nVisited, boolList &visited, labelList &order)
 Order intersection locations into a polygon. More...
 
void generateGeometryForLocations (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)
 
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

◆ protectedDivide()

scalar Foam::triIntersect::protectedDivide ( const scalar  a,
const scalar  b 
)

Divide two numbers and protect the result from overflowing.

Definition at line 48 of file triIntersect.C.

References b, Foam::mag(), and Foam::sign().

Referenced by solveProjectionGivenT(), srcPointTgtEdgeOffset(), and srcTriTgtPointIntersection().

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

◆ protectedDivideAndClip01()

scalar Foam::triIntersect::protectedDivideAndClip01 ( const scalar  a,
const scalar  b 
)

Divide two numbers, protect the result from overflowing, and clip the.

result between 0 and 1

Definition at line 56 of file triIntersect.C.

Referenced by srcEdgeTgtEdgeIntersection(), and srcEdgeTgtPointOffset().

Here is the caller graph for this function:

◆ 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 66 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.

it's 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 83 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 154 of file triIntersect.C.

References A, B, clipped01(), Foam::cof(), Cv(), Foam::det(), 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 198 of file triIntersect.C.

References clipped01(), Foam::cmptMag(), Foam::cmptMax(), Foam::cmptSum(), Cv(), forAll, Foam::mag(), Foam::magSqr(), Foam::patchToPatchTools::NaN(), 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:

◆ srcInTgt()

void Foam::triIntersect::srcInTgt ( 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,
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

Definition at line 300 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,
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

Definition at line 423 of file triIntersect.C.

Referenced by 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 479 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 
)

◆ generateGeometryForLocations()

void Foam::triIntersect::generateGeometryForLocations ( 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(), List< T >::size(), 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 691 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 762 of file triIntersect.C.

References A, Foam::det(), Foam::offset(), 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 783 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 802 of file triIntersect.C.

References A, Foam::det(), Foam::offset(), 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 822 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 841 of file triIntersect.C.

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

Referenced by generateGeometryForLocations().

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 989 of file triIntersect.C.

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

Referenced by generateGeometryForLocations().

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 generateGeometryForLocations().

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 1237 of file triIntersect.C.

References A, Foam::cmptMag(), Foam::det(), Foam::findMax(), Foam::mag(), Foam::T(), T0, and y.

Referenced by generateGeometryForLocations().

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 generateGeometryForLocations().

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 
)

◆ 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.