31 void Foam::plane::calcPntAndVec
41 const scalar magNormal =
mag(normal_);
54 if (magNormal >
mag(d)*vSmall)
56 point_ = - d/magNormal*normal_;
65 void Foam::plane::calcPntAndVec
72 normal_ =
normalised((point1 - point2) ^ (point2 - point3));
74 point_ = (point1 + point2 + point3)/3;
102 calcPntAndVec(a,
b,
c, d);
113 calcPntAndVec(point1, point2, point3);
122 const word planeType(
dict.lookup(
"planeType"));
124 const dictionary& subDict =
dict.optionalSubDict(planeType +
"Dict");
126 if (planeType ==
"planeEquation")
130 subDict.
lookup<scalar>(
"a"),
131 subDict.
lookup<scalar>(
"b"),
132 subDict.
lookup<scalar>(
"c"),
133 subDict.
lookup<scalar>(
"d")
136 else if (planeType ==
"embeddedPoints")
145 else if (planeType ==
"pointAndNormal")
150 {
"point",
"basePoint"}
158 {
"normal",
"normalVector"}
165 <<
"Invalid plane type: " << planeType <<
nl
166 <<
"Valid options include: "
167 <<
"planeEquation, embeddedPoints and pointAndNormal"
174 <<
"Plane normal has zero length"
181 <<
"Plane is too far from the origin"
200 scalar magX =
mag(normal_.x());
201 scalar magY =
mag(normal_.y());
202 scalar magZ =
mag(normal_.z());
209 C[1] = normal_.y()/normal_.x();
210 C[2] = normal_.z()/normal_.x();
214 C[0] = normal_.x()/normal_.z();
215 C[1] = normal_.y()/normal_.z();
223 C[0] = normal_.x()/normal_.y();
225 C[2] = normal_.z()/normal_.y();
229 C[0] = normal_.x()/normal_.z();
230 C[1] = normal_.y()/normal_.z();
235 C[3] = -
C[0] * point_.x()
246 const point& refPt = refPoint();
251 const scalar perturbX = refPt.
x() + 1
e-3;
252 const scalar perturbY = refPt.
y() + 1
e-3;
253 const scalar perturbZ = refPt.
z() + 1
e-3;
255 if (
mag(planeCoeffs[2]) < small)
257 if (
mag(planeCoeffs[1]) < small)
263 + planeCoeffs[1]*perturbY
264 + planeCoeffs[2]*perturbZ
279 + planeCoeffs[0]*perturbX
280 + planeCoeffs[2]*perturbZ
296 + planeCoeffs[0]*perturbX
297 + planeCoeffs[1]*perturbY
312 return p - normal_*signedDistance(
p);
318 return mag(signedDistance(
p));
324 return (
p - point_) & normal_;
334 const scalar num = (point_ - pnt0) & normal_;
335 const scalar den = dir & normal_;
337 return mag(den) >
mag(num)*vSmall ? num/den : vGreat;
348 const vector& n1 = normal();
351 const point& p1 = refPoint();
361 scalar magX =
mag(dir.
x());
362 scalar magY =
mag(dir.
y());
363 scalar magZ =
mag(dir.
z());
401 pt[i1] = (n2[i2]*n1p1 - n1[i2]*n2p2) / (n1[i1]*n2[i2] - n2[i1]*n1[i2]);
402 pt[i2] = (n2[i1]*n1p1 - n1[i1]*n2p2) / (n1[i2]*n2[i1] - n1[i1]*n2[i2]);
420 coeffs1[0],coeffs1[1],coeffs1[2],
421 coeffs2[0],coeffs2[1],coeffs2[2],
422 coeffs3[0],coeffs3[1],coeffs3[2]
425 vector b(coeffs1[3],coeffs2[3],coeffs3[3]);
427 return (
inv(a) & (-
b));
433 const scalar angle((
p - point_) & normal_);
435 return (angle < 0 ? FLIP : NORMAL);
441 const vector mirroredPtDir =
p - nearestPoint(
p);
443 if ((normal() & mirroredPtDir) > 0)
445 return p - 2.0*distance(
p)*normal();
449 return p + 2.0*distance(
p)*normal();
456 writeEntry(os,
"planeType",
"pointAndNormal");
457 os <<
indent <<
"pointAndNormalDict" <<
nl
469 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)
Ostream & incrIndent(Ostream &os)
Increment the indent level.
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.
dimensioned< scalar > mag(const dimensioned< Type > &)
Form normalised(const VectorSpace< Form, Cmpt, Ncmpts > &vs)
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
Ostream & operator<<(Ostream &, const ensightPart &)
Ostream & indent(Ostream &os)
Indent stream.