From da8ea0f21ac83c88b6cb46433c810cccf863e6b6 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 28 Apr 2017 09:12:33 +0200 Subject: [PATCH] ENH: refactor code from surfaceFeatureExtract to triSurfaceTools (issue #450) --- .../surfaceFeatureExtract.C | 1290 ++--------------- src/meshTools/Make/files | 8 + .../edgeMeshTools/edgeMeshFeatureProximity.C | 228 +++ .../edgeMesh/edgeMeshTools/edgeMeshTools.C | 65 + .../edgeMesh/edgeMeshTools/edgeMeshTools.H | 98 ++ .../extendedEdgeMesh/extendedEdgeMesh.H | 29 +- .../surfaceFeatures/surfaceFeatures.C | 332 ++++- .../surfaceFeatures/surfaceFeatures.H | 70 +- .../triSurfaceTools/triSurfaceCloseness.C | 360 +++++ .../triSurfaceTools/triSurfaceCurvature.C | 386 +++++ .../triSurfaceTools/triSurfaceTools.C | 50 - .../triSurfaceTools/triSurfaceTools.H | 118 +- 12 files changed, 1756 insertions(+), 1278 deletions(-) create mode 100644 src/meshTools/edgeMesh/edgeMeshTools/edgeMeshFeatureProximity.C create mode 100644 src/meshTools/edgeMesh/edgeMeshTools/edgeMeshTools.C create mode 100644 src/meshTools/edgeMesh/edgeMeshTools/edgeMeshTools.H create mode 100644 src/meshTools/triSurface/triSurfaceTools/triSurfaceCloseness.C create mode 100644 src/meshTools/triSurface/triSurfaceTools/triSurfaceCurvature.C diff --git a/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C b/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C index 3ae006e69d..1ea773f16b 100644 --- a/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C +++ b/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C @@ -31,817 +31,31 @@ Description Extracts and writes surface features to file. All but the basic feature extraction is a work-in-progress. - The curvature calculation is an implementation of the algorithm from: - \verbatim - "Estimating Curvatures and their Derivatives on Triangle Meshes" - by S. Rusinkiewicz - 3DPVT'04 Proceedings of the 3D Data Processing, - Visualization, and Transmission, 2nd International Symposium - Pages 486-493 - http://gfx.cs.princeton.edu/pubs/_2004_ECA/curvpaper.pdf - \endverbatim - \*---------------------------------------------------------------------------*/ #include "argList.H" #include "Time.H" #include "triSurface.H" +#include "triSurfaceTools.H" +#include "edgeMeshTools.H" #include "surfaceFeaturesExtraction.H" #include "surfaceIntersection.H" #include "featureEdgeMesh.H" #include "extendedFeatureEdgeMesh.H" #include "treeBoundBox.H" #include "meshTools.H" -#include "OFstream.H" +#include "OBJstream.H" #include "triSurfaceMesh.H" #include "vtkSurfaceWriter.H" -#include "triSurfaceFields.H" -#include "indexedOctree.H" -#include "treeDataEdge.H" #include "unitConversion.H" #include "plane.H" -#include "tensor2D.H" -#include "symmTensor2D.H" #include "point.H" -#include "triadField.H" -#include "transform.H" #include "triSurfaceLoader.H" using namespace Foam; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -scalar calcVertexNormalWeight -( - const triFace& f, - const label pI, - const vector& fN, - const pointField& points -) -{ - label index = findIndex(f, pI); - - if (index == -1) - { - FatalErrorInFunction - << "Point not in face" << abort(FatalError); - } - - const vector e1 = points[f[index]] - points[f[f.fcIndex(index)]]; - const vector e2 = points[f[index]] - points[f[f.rcIndex(index)]]; - - return mag(fN)/(magSqr(e1)*magSqr(e2) + VSMALL); -} - - -triadField calcVertexCoordSys -( - const triSurface& surf, - const vectorField& pointNormals -) -{ - const pointField& points = surf.points(); - const Map