32 void Foam::plane::calcPntAndVec
42 const scalar magNormal =
mag(normal_);
55 if (magNormal >
mag(d)*vSmall)
57 point_ = - d/magNormal*normal_;
66 void Foam::plane::calcPntAndVec
73 normal_ =
normalised((point1 - point2) ^ (point2 - point3));
75 point_ = (point1 + point2 + point3)/3;
103 calcPntAndVec(a,
b,
c, d);
114 calcPntAndVec(point1, point2, point3);
123 const word planeType(
dict.lookup(
"planeType"));
125 const dictionary& subDict =
dict.optionalSubDict(planeType +
"Dict");
127 if (planeType ==
"planeEquation")
137 else if (planeType ==
"embeddedPoints")
146 else if (planeType ==
"pointAndNormal")
151 {
"point",
"basePoint"},
160 {
"normal",
"normalVector"},
168 <<
"Invalid plane type: " << planeType <<
nl
169 <<
"Valid options include: "
170 <<
"planeEquation, embeddedPoints and pointAndNormal"
177 <<
"Plane normal has zero length"
184 <<
"Plane is too far from the origin"
203 scalar magX =
mag(normal_.x());
204 scalar magY =
mag(normal_.y());
205 scalar magZ =
mag(normal_.z());
212 C[1] = normal_.y()/normal_.x();
213 C[2] = normal_.z()/normal_.x();
217 C[0] = normal_.x()/normal_.z();
218 C[1] = normal_.y()/normal_.z();
226 C[0] = normal_.x()/normal_.y();
228 C[2] = normal_.z()/normal_.y();
232 C[0] = normal_.x()/normal_.z();
233 C[1] = normal_.y()/normal_.z();
238 C[3] = -
C[0] * point_.x()
249 const point& refPt = refPoint();
254 const scalar perturbX = refPt.
x() + 1
e-3;
255 const scalar perturbY = refPt.
y() + 1
e-3;
256 const scalar perturbZ = refPt.
z() + 1
e-3;
258 if (
mag(planeCoeffs[2]) < small)
260 if (
mag(planeCoeffs[1]) < small)
266 + planeCoeffs[1]*perturbY
267 + planeCoeffs[2]*perturbZ
282 + planeCoeffs[0]*perturbX
283 + planeCoeffs[2]*perturbZ
299 + planeCoeffs[0]*perturbX
300 + planeCoeffs[1]*perturbY
315 return p - normal_*signedDistance(
p);
321 return mag(signedDistance(
p));
327 return (
p - point_) & normal_;
337 const scalar num = (point_ - pnt0) & normal_;
338 const scalar den = dir & normal_;
340 return mag(den) >
mag(num)*vSmall ? num/den : vGreat;
351 const vector& n1 = normal();
354 const point& p1 = refPoint();
364 scalar magX =
mag(dir.
x());
365 scalar magY =
mag(dir.
y());
366 scalar magZ =
mag(dir.
z());
404 pt[i1] = (n2[i2]*n1p1 - n1[i2]*n2p2) / (n1[i1]*n2[i2] - n2[i1]*n1[i2]);
405 pt[i2] = (n2[i1]*n1p1 - n1[i1]*n2p2) / (n1[i2]*n2[i1] - n1[i1]*n2[i2]);
423 coeffs1[0],coeffs1[1],coeffs1[2],
424 coeffs2[0],coeffs2[1],coeffs2[2],
425 coeffs3[0],coeffs3[1],coeffs3[2]
428 vector b(coeffs1[3],coeffs2[3],coeffs3[3]);
430 return (
inv(a) & (-
b));
436 const scalar angle((
p - point_) & normal_);
438 return (angle < 0 ? FLIP : NORMAL);
444 const vector mirroredPtDir =
p - nearestPoint(
p);
446 if ((normal() & mirroredPtDir) > 0)
448 return p - 2.0*distance(
p)*normal();
452 return p + 2.0*distance(
p)*normal();
459 writeEntry(os,
"planeType",
"pointAndNormal");
460 os <<
indent <<
"pointAndNormalDict" <<
nl
472 if (a.point_ ==
b.point_ && a.normal_ ==
b.normal_)
static const Foam::dimensionedScalar C("C", Foam::dimTemperature, 234.5)
Graphite solid properties.
A 1D vector of objects of type <T> with a fixed size <Size>.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A list of keyword definitions, which are a keyword followed by any number of values (e....
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
ITstream & lookupBackwardsCompatible(const wordList &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream, trying a list of keywords.
A direction and a reference point.
Geometric class that creates a 2D plane and can return the intersection point between a line and the ...
const point & refPoint() const
Return the plane base point.
point mirror(const point &p) const
Mirror the supplied point in the plane. Return the mirrored point.
FixedList< scalar, 4 > planeCoeffs() const
Return coefficients for the plane equation, ax + by + cz + d = 0.
scalar normalIntersect(const point &pnt0, const vector &dir) const
Return cut coefficient for plane and line defined by.
side sideOfPlane(const point &p) const
Return the side of the plane that the point is on.
plane(const vector &normalVector)
Construct from normal vector through the origin.
scalar distance(const point &p) const
Return distance from the given point to the plane.
const vector & normal() const
Return the plane normal.
point aPoint() const
Return a point on the plane.
void writeDict(Ostream &) const
Write to dictionary.
point nearestPoint(const point &p) const
Return nearest point in the plane for the given point.
ray planeIntersect(const plane &) const
Return the cutting line between this plane and another.
point planePlaneIntersect(const plane &, const plane &) const
Return the cutting point between this plane and two other planes.
scalar signedDistance(const point &p) const
Return signed distance from the given point to the plane.
A class for handling words, derived from string.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
const dimensionedScalar c
Speed of light in a vacuum.
errorManipArg< error, int > exit(error &err, const int errNo=1)
bool operator!=(const particle &, const particle &)
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
const dimensionSet dimless
const dimensionSet dimLength
Ostream & incrIndent(Ostream &os)
Increment the indent level.
const unitConversion unitNone
vector point
Point is a vector.
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Vector< scalar > vector
A scalar version of the templated Vector.
dimensionSet normalised(const dimensionSet &)
dimensioned< scalar > mag(const dimensioned< Type > &)
Ostream & operator<<(Ostream &os, const fvConstraints &constraints)
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
Ostream & indent(Ostream &os)
Indent stream.