39 os <<
"v " << tri[0].x() <<
" " << tri[0].y() <<
" 0" <<
nl 40 <<
"v " << tri[1].x() <<
" " << tri[1].y() <<
" 0" <<
nl 41 <<
"v " << tri[2].x() <<
" " << tri[2].y() <<
" 0" <<
nl 88 return 0.5*e1.perp(e2);
96 return (1.0/3.0)*(tri[0] + tri[1] + tri[2]);
112 const scalar rcs = r.
perp(
s);
114 if (
mag(rcs) > ROOTVSMALL)
116 const scalar u = (sp1 - lp1).perp(r)/rcs;
118 if (u >= -relTol && u <= 1+relTol)
142 OFstream
os(
"bad-intersection.obj");
143 os <<
"v " << lp1.
x() <<
" " << lp1.
y() <<
" 0" <<
nl 144 <<
"v " << lp2.
x() <<
" " << lp2.
y() <<
" 0" <<
nl 145 <<
"v " << sp1.
x() <<
" " << sp1.
y() <<
" 0" <<
nl 146 <<
"v " << sp2.
x() <<
" " << sp2.
y() <<
" 0" <<
nl 201 return mag(area_) < SMALL ? 0 :
sign(area_);
209 && pointInside(tri[1])
210 && pointInside(tri[2]);
219 triA[0].isClose(triB[0])
220 && triA[1].isClose(triB[1])
221 && triA[2].isClose(triB[2]);
229 for (
int i = 0; i < 3; ++i)
231 if ((triA[(i + 1) % 3] - triA[i]).perp(
p - triA[i]) < 0)
dimensionedScalar sign(const dimensionedScalar &ds)
bool match(const UList< wordRe > &patterns, const std::string &text)
Return true if text matches one of the regular expressions.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
const Cmpt & y() const noexcept
Access to the vector y component.
constexpr char nl
The newline '\n' character (0x0a)
Vector2D< scalar > vector2D
A 2D vector of scalars obtained from the generic Vector2D.
Ostream & endl(Ostream &os)
Add newline and flush stream.
scalar perp(const Vector2D< Cmpt > &b) const
Perp dot product (dot product with perpendicular vector)
scalar area() const noexcept
Return the triangle area.
#define forAll(list, i)
Loop across all elements in list.
static label nClosePoints(const triangle2D &triA, const triangle2D &triB)
Return the number of similar points between two triangles.
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
static bool lineIntersectionPoint(const vector2D &a, const vector2D &b, const vector2D &c, const vector2D &d, vector2D &intersection)
Set the intersection between two lines Return true if lines intersect.
#define DebugInfo
Report an information message using Foam::Info.
label order() const
Returns: 1 if points are ordered in anti-clockwise direction -1 if points are ordered in clockwise di...
An Ostream is an abstract base class for all output systems (streams, files, token lists...
static bool lineSegmentIntersectionPoint(const vector2D &lp1, const vector2D &lp2, const vector2D &sp1, const vector2D &sp2, vector2D &intersection)
Set the intersection between a line and segment Return true if lines intersect.
int debug
Static debugging option.
OBJstream os(runTime.globalPath()/outputName)
const Cmpt & x() const noexcept
Access to the vector x component.
static void writeOBJ(Ostream &os, const triangle2D &tri, label offset)
Write the triangle in OBJ format.
bool isSame(const triangle2D &triB) const
Return true if triB is the same as this triangle.
vector2D centre() const
Return the triangle centre.
bool isClose(const Vector2D< Cmpt > &b, const scalar tol=1e-10) const
Return true if vector is within tol.
const dimensionedScalar c
Speed of light in a vacuum.
static bool lineIntersects(const vector2D &a, const vector2D &b, const vector2D &c, const vector2D &d)
Return true if lines ab and cd intersect.
bool contains(const triangle2D &tri) const
Return true if tri is within this triangle.
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))
bool pointInside(const vector2D &p) const
Return true if t point p is inside this triangle.