37void Foam::triangleFuncs::setIntersection
39 const point& oppositeSidePt,
40 const scalar oppositeSign,
42 const point& thisSidePt,
43 const scalar thisSign,
50 const scalar denom = oppositeSign - thisSign;
59 pt = oppositeSidePt + oppositeSign/denom*(thisSidePt - oppositeSidePt);
73 const scalar maxLength,
82 label i1 = (i0 + 1) % 3;
83 label i2 = (i1 + 1) % 3;
93 scalar
det = v2*u1 - u2*v1;
99 if (localScale < VSMALL ||
Foam::mag(
det)/localScale < SMALL)
107 const point& P = origin[originI];
109 scalar
u0 = P[i1] - V0[i1];
110 scalar v0 = P[i2] - V0[i2];
138 scalar
s = (pInter - origin[originI])[i0];
140 if ((
s >= 0) && (
s <= maxLength))
174 if (inter.hit() && inter.distance() <= 1)
187 cubeBb.intersects(tri.a(), tri.b(), pInter)
188 || cubeBb.intersects(tri.b(), tri.c(), pInter)
189 || cubeBb.intersects(tri.c(), tri.a(), pInter)
223 scalar magArea =
mag(na);
226 if (
mag(na & normal) > (1 - SMALL))
232 const point va1 = va0 + va10;
233 const point va2 = va0 + va20;
236 scalar sign0 = (va0 - base) & normal;
237 scalar sign1 = (va1 - base) & normal;
238 scalar sign2 = (va2 - base) & normal;
240 label oppositeVertex = -1;
303 if (oppositeVertex == 0)
306 setIntersection(va0, sign0, va1, sign1, tol, pInter0);
307 setIntersection(va0, sign0, va2, sign2, tol, pInter1);
309 else if (oppositeVertex == 1)
312 setIntersection(va1, sign1, va0, sign0, tol, pInter0);
313 setIntersection(va1, sign1, va2, sign2, tol, pInter1);
318 setIntersection(va2, sign2, va0, sign0, tol, pInter0);
319 setIntersection(va2, sign2, va1, sign1, tol, pInter1);
350 if (!intersect(va0, va10, va20, vb0, nb, planeB0, planeB1))
358 if (!intersect(vb0, vb10, vb20, va0, na, planeA0, planeA1))
381 sortCoords[0] = coordB0;
385 sortCoords[1] = coordB1;
389 sortCoords[2] = coordA0;
393 sortCoords[3] = coordA1;
397 const labelList& indices = sortCoords.indices();
399 if (isFromB[indices[0]] == isFromB[indices[1]])
408 pInter0 = *
pts[indices[1]];
409 pInter1 = *
pts[indices[2]];
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
scalar distance() const noexcept
Return distance to hit.
bool hit() const noexcept
Is there a hit.
A list that is sorted upon construction or when explicitly requested with the sort() method.
const labelList & indices() const noexcept
Return the list of sorted indices. Updated every sort.
void sort()
Forward (stable) sort the list (if changed after construction).
An edge is a list of two vertex labels. This can correspond to a directed graph edge or an edge on a ...
Standard boundBox with extra functionality for use in octree.
static const edgeList edges
Edge to point addressing, using octant corner points.
tmp< pointField > points() const
Vertex coordinates. In octant coding.
bool intersects(const point &overallStart, const vector &overallVec, const point &start, const point &end, point &pt, direction &ptBits) const
Intersects segment; set point to intersection position and face,.
static bool intersectBb(const triPointRef &tri, const treeBoundBox &cubeBb)
Intersect triangle with bounding box.
static bool intersect(const point &va0, const point &va10, const point &va20, const point &basePoint, const vector &normal, point &pInter0, point &pInter1)
Intersect triangle with plane.
static bool intersectAxesBundle(const point &V0, const point &V10, const point &V20, const label i0, const pointField &origin, const scalar maxLength, point &pInter)
Intersect triangle with parallel edges aligned with axis i0.
const Point & b() const noexcept
The second vertex.
pointHit intersection(const point &p, const vector &q, const intersection::algorithm alg, const scalar tol=0.0) const
Fast intersection with a ray.
const Point & c() const noexcept
The third vertex.
const Point & a() const noexcept
The first vertex.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
const volScalarField & p0
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
dimensionedScalar det(const dimensionedSphericalTensor &dt)
PointHit< point > pointHit
A PointHit with a 3D point.
List< label > labelList
A List of labels.
dimensionedScalar sqrt(const dimensionedScalar &ds)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
vector point
Point is a vector.
List< bool > boolList
A List of bools.
triangle< point, const point & > triPointRef
A triangle using referred points.
vectorField pointField
pointField is a vectorField.
dimensionedScalar beta("beta", dimless/dimTemperature, laminarTransport)
#define forAll(list, i)
Loop across all elements in list.