mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: plane: Add member function that mirrors a point in a plane
This commit is contained in:
@ -301,8 +301,8 @@ void Foam::conformalVoronoiMesh::createEdgePointGroupByCirculating
|
||||
Foam::point pt1 = edgePt + s + ppDist*normal;
|
||||
Foam::point pt2 = edgePt - s + ppDist*normal;
|
||||
|
||||
Foam::point pt3 = reflectPointInPlane(pt1, facePlane);
|
||||
Foam::point pt4 = reflectPointInPlane(pt2, facePlane);
|
||||
Foam::point pt3 = facePlane.mirror(pt1);
|
||||
Foam::point pt4 = facePlane.mirror(pt2);
|
||||
|
||||
pts.append(Vb(pt1, Vb::vtInternalFeatureEdge));
|
||||
pts.append(Vb(pt2, Vb::vtInternalFeatureEdge));
|
||||
@ -449,7 +449,7 @@ void Foam::conformalVoronoiMesh::createEdgePointGroupByCirculating
|
||||
if (masterPointReflectionsPrev.found(iter.key()))
|
||||
{
|
||||
const Foam::point reflectedPt =
|
||||
reflectPointInPlane(pt, masterPointReflectionsPrev[iter.key()]);
|
||||
masterPointReflectionsPrev[iter.key()].mirror(pt);
|
||||
|
||||
// Info<< " Adding Prev " << reflectedPt << " "
|
||||
// << indexedVertexEnum::vertexTypeNames_[reflectedPtType]
|
||||
@ -461,7 +461,7 @@ void Foam::conformalVoronoiMesh::createEdgePointGroupByCirculating
|
||||
if (masterPointReflectionsNext.found(iter.key()))
|
||||
{
|
||||
const Foam::point reflectedPt =
|
||||
reflectPointInPlane(pt, masterPointReflectionsNext[iter.key()]);
|
||||
masterPointReflectionsNext[iter.key()].mirror(pt);
|
||||
|
||||
// Info<< " Adding Next " << reflectedPt << " "
|
||||
// << indexedVertexEnum::vertexTypeNames_[reflectedPtType]
|
||||
@ -815,8 +815,8 @@ void Foam::conformalVoronoiMesh::createOpenEdgePointGroup
|
||||
Foam::point pt1 = edgePt + s + ppDist*n;
|
||||
Foam::point pt2 = edgePt - s + ppDist*n;
|
||||
|
||||
Foam::point pt3 = reflectPointInPlane(pt1, facePlane);
|
||||
Foam::point pt4 = reflectPointInPlane(pt2, facePlane);
|
||||
Foam::point pt3 = facePlane.mirror(pt1);
|
||||
Foam::point pt4 = facePlane.mirror(pt2);
|
||||
|
||||
pts.append(Vb(pt1, Vb::vtInternalSurface));
|
||||
pts.append(Vb(pt2, Vb::vtInternalSurface));
|
||||
@ -1235,8 +1235,7 @@ void Foam::conformalVoronoiMesh::addMasterAndSlavePoints
|
||||
|
||||
const plane& reflPlane = masterPointPlanes[planeI]();
|
||||
|
||||
const Foam::point slavePt =
|
||||
reflectPointInPlane(masterPt, reflPlane);
|
||||
const Foam::point slavePt = reflPlane.mirror(masterPt);
|
||||
|
||||
// Info<< " Slave " << planeI << " = " << slavePt << endl;
|
||||
|
||||
@ -1717,27 +1716,9 @@ Foam::List<Foam::point> Foam::conformalVoronoiMesh::reflectPointInPlanes
|
||||
|
||||
forAll(planes, planeI)
|
||||
{
|
||||
reflectedPoints[planeI] = reflectPointInPlane(p, planes[planeI]());
|
||||
reflectedPoints[planeI] = planes[planeI]().mirror(p);
|
||||
}
|
||||
|
||||
return reflectedPoints;
|
||||
}
|
||||
|
||||
|
||||
Foam::point Foam::conformalVoronoiMesh::reflectPointInPlane
|
||||
(
|
||||
const Foam::point p,
|
||||
const plane& planeN
|
||||
) const
|
||||
{
|
||||
const vector reflectedPtDir = p - planeN.nearestPoint(p);
|
||||
|
||||
if ((planeN.normal() & reflectedPtDir) > 0)
|
||||
{
|
||||
return p - 2.0*planeN.distance(p)*planeN.normal();
|
||||
}
|
||||
else
|
||||
{
|
||||
return p + 2.0*planeN.distance(p)*planeN.normal();
|
||||
}
|
||||
}
|
||||
|
||||
@ -447,6 +447,21 @@ Foam::plane::side Foam::plane::sideOfPlane(const point& p) const
|
||||
}
|
||||
|
||||
|
||||
Foam::point Foam::plane::mirror(const point& p) const
|
||||
{
|
||||
const vector mirroredPtDir = p - nearestPoint(p);
|
||||
|
||||
if ((normal() & mirroredPtDir) > 0)
|
||||
{
|
||||
return p - 2.0*distance(p)*normal();
|
||||
}
|
||||
else
|
||||
{
|
||||
return p + 2.0*distance(p)*normal();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::plane::writeDict(Ostream& os) const
|
||||
{
|
||||
os.writeKeyword("planeType") << "pointAndNormal"
|
||||
|
||||
@ -194,6 +194,9 @@ public:
|
||||
// If the point is on the plane, then returns NORMAL.
|
||||
side sideOfPlane(const point& p) const;
|
||||
|
||||
//- Mirror the supplied point in the plane. Return the mirrored point.
|
||||
point mirror(const point& p) const;
|
||||
|
||||
//- Write to dictionary
|
||||
void writeDict(Ostream&) const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user