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 > | |
Ostream & | operator<< (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, vector > | 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. 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) |
Ostream & | operator<< (Ostream &, const location &) |
Variables | |
const scalar | maxDot = - cos(degToRad(80)) |
The maximum dot product between a source point normal and a target plane. More... | |
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 Foam::constant::physicoChemical::b, Foam::mag(), Foam::max(), protectedDivideAndClip01(), and Foam::sign().
Referenced by solveProjectionGivenT(), srcInTgt(), srcPointTgtEdgeOffset(), and srcTriTgtPointIntersection().
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 protectedDivide(), srcEdgeTgtEdgeIntersection(), and srcEdgeTgtPointOffset().
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, clipped01(), token::END_LIST, Foam::findMax(), forAll, Foam::constant::atomic::group, Foam::max(), Foam::min(), n, phi, solveProjectionGivenT(), token::SPACE, x, and y.
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 operator<<(), solveProjection(), and 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 155 of file triIntersect.C.
References clipped01(), Foam::cof(), Foam::det(), protectedDivide(), solveProjection(), Vector2D< Cmpt >::x(), and Vector2D< Cmpt >::y().
Referenced by operator<<(), solveProjection(), and srcTriTgtPointIntersection().
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 199 of file triIntersect.C.
References clipped01(), Foam::cmptMag(), Foam::cmptMax(), Foam::cmptSum(), forAll, Foam::mag(), Foam::magSqr(), Foam::real, cubicEqn::roots(), solveProjectionGivenT(), srcInTgt(), Foam::Swap(), Roots< N >::type(), and VectorSpace< Vector< scalar >, scalar, 3 >::uniform().
Referenced by solveProjectionGivenT(), srcEdgeTgtEdgeIntersection(), and srcTriTgtPointIntersection().
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 299 of file triIntersect.C.
References Foam::count(), forAll, triangle< Point, PointRef >::normal(), protectedDivide(), srcPointTgtEdgeOffset(), and tgtInSrc().
Referenced by intersectTris(), and solveProjection().
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 422 of file triIntersect.C.
References Foam::count(), forAll, triangle< Point, PointRef >::normal(), srcEdgeTgtPointOffset(), srcTriInterpolate(), srcTriTgtPointIntersection(), and thisIsOther().
Referenced by intersectTris(), and srcInTgt().
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 478 of file triIntersect.C.
References forAll, and orderLocations().
Referenced by intersectTris(), and tgtInSrc().
bool Foam::triIntersect::orderLocations | ( | const UList< location > & | locations, |
bool | isSrcEdge, | ||
const label | i0, | ||
label & | nVisited, | ||
boolList & | visited, | ||
labelList & | order | ||
) |
Order intersection locations into a polygon.
Definition at line 503 of file triIntersect.C.
References UList< T >::first(), forAll, generateGeometryForLocations(), location::isIntersection(), location::isSrcAndTgtPoint(), location::isSrcNotTgtPoint(), location::isSrcPoint(), location::isTgtNotSrcPoint(), location::isTgtPoint(), location::srcEdgei(), location::srcPointi(), location::tgtEdgei(), and location::tgtPointi().
Referenced by thisIsOther().
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 | ||
) |
Definition at line 610 of file triIntersect.C.
References Pair< Type >::first(), forAll, location::isSrcAndTgtPoint(), location::isSrcPoint(), location::isTgtPoint(), DynamicList< T, SizeInc, SizeMult, SizeDiv >::resize(), Pair< Type >::second(), List< T >::size(), location::srcEdgei(), srcEdgeTgtEdgeIntersection(), location::srcPointi(), srcPointTgtTriIntersection(), srcTriInterpolate(), srcTriTgtPointIntersection(), location::tgtEdgei(), location::tgtPointi(), tgtTriInterpolate(), and writeTriProjection().
Referenced by intersectTris(), and orderLocations().
void writePolygon | ( | const word & | name, |
const PointField & | ps | ||
) |
Write a VTK file of a polygon.
Definition at line 33 of file triIntersectTemplates.C.
References Foam::endl(), Foam::identity(), Foam::indent(), Foam::Info, List< T >::size(), srcTriInterpolate(), and Foam::vtkWriteOps::write().
Referenced by intersectTris().
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 690 of file triIntersect.C.
References Foam::endl(), Foam::indent(), Foam::Info, Foam::mag(), Foam::max(), srcEdgeTgtPointOffset(), u0, and Foam::vtkWritePolyData::write().
Referenced by generateGeometryForLocations(), and intersectTris().
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 761 of file triIntersect.C.
References Foam::det(), protectedDivideAndClip01(), Foam::T(), Tensor< Cmpt >::x(), Tensor< Cmpt >::y(), and Tensor< Cmpt >::z().
Referenced by srcEdgeTgtEdgeIntersection(), srcEdgeTgtPointOffset(), srcTriTgtPointIntersection(), tgtInSrc(), and writeTriProjection().
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 782 of file triIntersect.C.
References Foam::reverse(), srcEdgeTgtPointOffset(), and srcPointTgtEdgeOffset().
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 801 of file triIntersect.C.
References Foam::det(), protectedDivide(), Foam::T(), Tensor< Cmpt >::x(), Tensor< Cmpt >::y(), and Tensor< Cmpt >::z().
Referenced by srcEdgeTgtPointOffset(), srcInTgt(), and srcPointTgtEdgeOffset().
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 821 of file triIntersect.C.
References Foam::reverse(), srcEdgeTgtEdgeIntersection(), and srcPointTgtEdgeOffset().
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 840 of file triIntersect.C.
References Foam::det(), Tuple2< Type1, Type2 >::first(), Foam::log2(), Foam::mag(), protectedDivideAndClip01(), s(), Tuple2< Type1, Type2 >::second(), Foam::sign(), solveProjection(), srcEdgeTgtPointOffset(), srcTriTgtPointIntersection(), Tensor< Cmpt >::y(), Tensor< Cmpt >::z(), and Foam::Zero.
Referenced by generateGeometryForLocations(), and srcPointTgtEdgeOffset().
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 988 of file triIntersect.C.
References Foam::exit(), Foam::FatalError, FatalErrorInFunction, Foam::findMax(), Foam::findMin(), Tuple2< Type1, Type2 >::first(), forAll, Foam::log2(), protectedDivide(), Tuple2< Type1, Type2 >::second(), Foam::sign(), solveProjection(), solveProjectionGivenT(), srcEdgeTgtPointOffset(), srcPointTgtTriIntersection(), T0, VectorSpace< Barycentric2D< Cmpt >, Cmpt, 3 >::uniform(), Tensor< Cmpt >::x(), y, Tensor< Cmpt >::y(), and Tensor< Cmpt >::z().
Referenced by generateGeometryForLocations(), srcEdgeTgtEdgeIntersection(), and tgtInSrc().
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 54 of file triIntersectTemplates.C.
References Foam::findMax(), Foam::findMin(), and tgtTriInterpolate().
Referenced by generateGeometryForLocations(), tgtInSrc(), and writePolygon().
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 1236 of file triIntersect.C.
References Foam::cmptMag(), Foam::det(), Foam::findMax(), intersectTris(), Foam::mag(), Foam::T(), T0, Vector< Cmpt >::x(), Tensor< Cmpt >::x(), y, Vector< Cmpt >::y(), Tensor< Cmpt >::y(), Vector< Cmpt >::z(), and Tensor< Cmpt >::z().
Referenced by generateGeometryForLocations(), and srcTriTgtPointIntersection().
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 87 of file triIntersectTemplates.C.
References Barycentric2D< Cmpt >::a(), Barycentric2D< Cmpt >::b(), and Barycentric2D< Cmpt >::c().
Referenced by generateGeometryForLocations(), and srcTriInterpolate().
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 1262 of file triIntersect.C.
References Foam::add(), DynamicList< T, SizeInc, SizeMult, SizeDiv >::append(), DynamicList< T, SizeInc, SizeMult, SizeDiv >::clear(), Foam::count(), Foam::decrIndent(), UList< T >::empty(), Foam::endl(), Foam::findIndex(), UList< T >::first(), forAll, generateGeometryForLocations(), Foam::incrIndent(), Foam::indent(), Foam::Info, Foam::inplaceReverseList(), location::intersection(), location::isIntersection(), location::isSrcAndTgtPoint(), UList< T >::last(), word::null, Foam::reverse(), location::srcEdgei(), srcInTgt(), location::srcPoint(), location::srcPointi(), location::srcTgtPoint(), Foam::Swap(), location::tgtEdgei(), tgtInSrc(), location::tgtPoint(), location::tgtPointi(), thisIsOther(), Foam::vtkWriteOps::write(), writePolygon(), and writeTriProjection().
Referenced by intersection::srcBoxStatic(), and srcPointTgtTriIntersection().
Definition at line 190 of file triIntersectLocationI.H.
Definition at line 198 of file triIntersectLocationI.H.
References Foam::constant::physicoChemical::b.
Foam::Ostream & operator<< | ( | Ostream & | os, |
const location & | l | ||
) |
Definition at line 32 of file triIntersectLocationIO.C.
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.