32 void Foam::plane::calcPntAndVec(
const scalarList& C)
34 if (
mag(C[0]) > VSMALL)
36 basePoint_ =
vector((-C[3]/C[0]), 0, 0);
40 if (
mag(C[1]) > VSMALL)
42 basePoint_ =
vector(0, (-C[3]/C[1]), 0);
46 if (
mag(C[2]) > VSMALL)
48 basePoint_ =
vector(0, 0, (-C[3]/C[2]));
52 FatalErrorIn(
"void plane::calcPntAndVec(const scalarList&)")
53 <<
"At least one plane coefficient must have a value" 59 unitVector_ =
vector(C[0], C[1], C[2]);
60 scalar magUnitVector(
mag(unitVector_));
62 if (magUnitVector < VSMALL)
64 FatalErrorIn(
"void plane::calcPntAndVec(const scalarList&)")
65 <<
"Plane normal defined with zero length" 69 unitVector_ /= magUnitVector;
73 void Foam::plane::calcPntAndVec
80 basePoint_ = (point1 + point2 + point3)/3;
81 vector line12 = point1 - point2;
82 vector line23 = point2 - point3;
87 ||
mag(line23) < VSMALL
88 ||
mag(point3-point1) < VSMALL
93 "void plane::calcPntAndVec\n" 99 ) <<
"Bad points:" << point1 <<
' ' << point2 <<
' ' << point3
103 unitVector_ = line12 ^ line23;
104 scalar magUnitVector(
mag(unitVector_));
106 if (magUnitVector < VSMALL)
110 "void plane::calcPntAndVec\n" 116 ) <<
"Plane normal defined with zero length" <<
nl 117 <<
"Bad points:" << point1 <<
' ' << point2 <<
' ' << point3
121 unitVector_ /= magUnitVector;
130 unitVector_(normalVector),
133 scalar magUnitVector(
mag(unitVector_));
135 if (magUnitVector > VSMALL)
137 unitVector_ /= magUnitVector;
142 <<
"plane normal has zero length. basePoint:" << basePoint_
151 unitVector_(normalVector),
152 basePoint_(basePoint)
154 scalar magUnitVector(
mag(unitVector_));
156 if (magUnitVector > VSMALL)
158 unitVector_ /= magUnitVector;
162 FatalErrorIn(
"plane::plane(const point&, const vector&)")
163 <<
"plane normal has zero length. basePoint:" << basePoint_
184 calcPntAndVec(a, b, c);
194 const word planeType(dict.
lookup(
"planeType"));
196 if (planeType ==
"planeEquation")
209 else if (planeType ==
"embeddedPoints")
217 calcPntAndVec(point1, point2, point3);
219 else if (planeType ==
"pointAndNormal")
223 basePoint_ = subDict.
lookup(
"basePoint");
224 unitVector_ = subDict.
lookup(
"normalVector");
225 unitVector_ /=
mag(unitVector_);
230 <<
"Invalid plane type: " << planeType <<
nl 231 <<
"Valid options include: planeEquation, embeddedPoints and " 244 scalar magUnitVector(
mag(unitVector_));
246 if (magUnitVector > VSMALL)
248 unitVector_ /= magUnitVector;
253 <<
"plane normal has zero length. basePoint:" << basePoint_
280 scalar magX =
mag(unitVector_.
x());
281 scalar magY =
mag(unitVector_.
y());
282 scalar magZ =
mag(unitVector_.
z());
289 C[1] = unitVector_.
y()/unitVector_.
x();
290 C[2] = unitVector_.
z()/unitVector_.
x();
294 C[0] = unitVector_.
x()/unitVector_.
z();
295 C[1] = unitVector_.
y()/unitVector_.
z();
303 C[0] = unitVector_.
x()/unitVector_.
y();
305 C[2] = unitVector_.
z()/unitVector_.
y();
309 C[0] = unitVector_.
x()/unitVector_.
z();
310 C[1] = unitVector_.
y()/unitVector_.
z();
315 C[3] = - C[0] * basePoint_.
x()
316 - C[1] * basePoint_.
y()
317 - C[2] * basePoint_.
z();
326 return p - unitVector_*((p - basePoint_) & unitVector_);
333 return mag((p - basePoint_) & unitVector_);
344 scalar denom =
stabilise((dir & unitVector_), VSMALL);
346 return ((basePoint_ - pnt0) & unitVector_)/denom;
371 scalar magX =
mag(dir.
x());
372 scalar magY =
mag(dir.
y());
373 scalar magZ =
mag(dir.
z());
411 pt[i1] = (n2[i2]*n1p1 - n1[i2]*n2p2) / (n1[i1]*n2[i2] - n2[i1]*n1[i2]);
412 pt[i2] = (n2[i1]*n1p1 - n1[i1]*n2p2) / (n1[i2]*n2[i1] - n1[i1]*n2[i2]);
431 coeffs1[0],coeffs1[1],coeffs1[2],
432 coeffs2[0],coeffs2[1],coeffs2[2],
433 coeffs3[0],coeffs3[1],coeffs3[2]
436 vector b(coeffs1[3],coeffs2[3],coeffs3[3]);
438 return (
inv(a) & (-b));
444 const scalar angle((p - basePoint_) & unitVector_);
454 if ((
normal() & mirroredPtDir) > 0)
469 os <<
indent <<
"pointAndNormalDict" << nl
482 if (a.basePoint_ == b.basePoint_ && a.unitVector_ == b.unitVector_)
plane(const vector &normalVector)
Construct from normal vector through the origin.
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
vector point
Point is a vector.
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
dimensioned< scalar > mag(const dimensioned< Type > &)
const vector & normal() const
Return plane normal.
Ostream & indent(Ostream &os)
Indent stream.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
FixedList< scalar, 4 > planeCoeffs() const
Return coefficients for the.
A class for handling words, derived from string.
point planePlaneIntersect(const plane &, const plane &) const
Return the cutting point between this plane and two other planes.
A 1D vector of objects of type <T> with a fixed size <Size>.
A list of keyword definitions, which are a keyword followed by any number of values (e...
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Ostream & operator<<(Ostream &, const edgeMesh &)
Ostream & incrIndent(Ostream &os)
Increment the indent level.
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if succesful.
bool operator!=(const particle &, const particle &)
A class representing the concept of 0 used to avoid unnecessary manipulations for objects that are kn...
List< scalar > scalarList
A List of scalars.
errorManip< error > abort(error &err)
Ostream & writeKeyword(const keyType &)
Write the keyword followed by an appropriate indentation.
point nearestPoint(const point &p) const
Return nearest point in the plane for the given point.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
tmp< DimensionedField< scalar, GeoMesh > > stabilise(const DimensionedField< scalar, GeoMesh > &dsf, const dimensioned< scalar > &ds)
Geometric class that creates a 2D plane and can return the intersection point between a line and the ...
side sideOfPlane(const point &p) const
Return the side of the plane that the point is on.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
ray planeIntersect(const plane &) const
Return the cutting line between this plane and another.
const point & refPoint() const
Return or return plane base point.
scalar normalIntersect(const point &pnt0, const vector &dir) const
Return cut coefficient for plane and line defined by.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Vector< scalar > vector
A scalar version of the templated Vector.
point mirror(const point &p) const
Mirror the supplied point in the plane. Return the mirrored point.
#define FatalIOErrorIn(functionName, ios)
Report an error message using Foam::FatalIOError.
scalar distance(const point &p) const
Return distance from the given point to the plane.
void writeDict(Ostream &) const
Write to dictionary.
A direction and a reference point.