diff --git a/applications/utilities/surface/surfaceBooleanFeatures/surfaceBooleanFeatures.C b/applications/utilities/surface/surfaceBooleanFeatures/surfaceBooleanFeatures.C index 9954267f32..93e4f62690 100644 --- a/applications/utilities/surface/surfaceBooleanFeatures/surfaceBooleanFeatures.C +++ b/applications/utilities/surface/surfaceBooleanFeatures/surfaceBooleanFeatures.C @@ -215,6 +215,29 @@ bool intersectSurfaces } +label calcNormalDirection +( + const vector& normal, + const vector& otherNormal, + const vector& edgeDir, + const vector& faceCentre, + const vector& pointOnEdge +) +{ + vector cross = (normal ^ edgeDir); + cross /= mag(cross); + + vector fC0tofE0 = faceCentre - pointOnEdge; + fC0tofE0 /= mag(fC0tofE0); + + label nDir = ((cross & fC0tofE0) > 0.0 ? 1 : -1); + + nDir *= ((otherNormal & fC0tofE0) > 0.0 ? -1 : 1); + + return nDir; +} + + int main(int argc, char *argv[]) { argList::noParallel(); @@ -222,6 +245,18 @@ int main(int argc, char *argv[]) argList::validArgs.append("surface file"); argList::validArgs.append("surface file"); + argList::addBoolOption + ( + "surf1Baffle", + "Mark surface 1 as a baffle" + ); + + argList::addBoolOption + ( + "surf2Baffle", + "Mark surface 2 as a baffle" + ); + argList::addBoolOption ( "perturb", @@ -250,10 +285,10 @@ int main(int argc, char *argv[]) { FatalErrorIn(args.executable()) << "Unsupported action " << action << endl - << "Supported actions:" << validActions.toc() << exit(FatalError); + << "Supported actions:" << validActions.toc() << abort(FatalError); } - fileName surf1Name(args[2]); + fileName surf1Name(args.args()[2]); Info<< "Reading surface " << surf1Name << endl; triSurface surf1(surf1Name); @@ -269,6 +304,9 @@ int main(int argc, char *argv[]) surf2.writeStats(Info); Info<< endl; + const bool surf1Baffle = args.optionFound("surf1Baffle"); + const bool surf2Baffle = args.optionFound("surf2Baffle"); + edgeIntersections edge1Cuts; edgeIntersections edge2Cuts; @@ -330,53 +368,143 @@ int main(int argc, char *argv[]) label nFeatEds = inter.cutEdges().size(); - vectorField normals(2*nFeatEds, vector::zero); + DynamicList normals(2*nFeatEds); vectorField edgeDirections(nFeatEds, vector::zero); - labelListList edgeNormals(nFeatEds, labelList(2, label(-1))); + DynamicList