1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | cfMesh: A library for mesh generation
5 \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6 \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of cfMesh.
11 cfMesh is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 3 of the License, or (at your
14 option) any later version.
16 cfMesh is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
26 \*---------------------------------------------------------------------------*/
28 #include "triSurfaceCurvatureEstimator.H"
29 #include "demandDrivenData.H"
37 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 triSurfaceCurvatureEstimator::triSurfaceCurvatureEstimator
46 const triSurf& surface
50 edgePointCurvature_(),
56 maxCurvatureVector_(),
59 calculateEdgeCurvature();
60 calculateSurfaceCurvatures();
61 //calculateGaussianCurvature();
62 //calculateMeanCurvature();
63 //calculateMinAndMaxCurvature();
66 triSurfaceCurvatureEstimator::~triSurfaceCurvatureEstimator()
69 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
71 scalar triSurfaceCurvatureEstimator::edgePointCurvature(const label pI) const
73 return edgePointCurvature_[pI];
76 scalar triSurfaceCurvatureEstimator::curvatureAtEdge(const label edgeI) const
78 const edge& edg = surface_.edges()[edgeI];
80 const scalar k1 = edgePointCurvature_[edg.start()];
81 const scalar k2 = edgePointCurvature_[edg.end()];
83 return (k1 + k2) / 2.0;
86 scalar triSurfaceCurvatureEstimator::gaussianCurvatureAtTriangle
91 const labelledTri& tri = surface_[triI];
94 for(label i=0;i<3;++i)
95 curv += gaussianCurvature_[tri[i]][patchPositions_(triI, i)];
101 scalar triSurfaceCurvatureEstimator::meanCurvatureAtTriangle
106 const labelledTri& tri = surface_[triI];
109 for(label i=0;i<3;++i)
110 curv += meanCurvature_[tri[i]][patchPositions_(triI, i)];
116 scalar triSurfaceCurvatureEstimator::maxCurvatureAtTriangle
121 const labelledTri& tri = surface_[triI];
124 for(label i=0;i<3;++i)
125 curv += maxCurvature_[tri[i]][patchPositions_(triI, i)];
131 scalar triSurfaceCurvatureEstimator::minCurvatureAtTriangle
136 const labelledTri& tri = surface_[triI];
139 for(label i=0;i<3;++i)
140 curv += minCurvature_[tri[i]][patchPositions_(triI, i)];
146 vector triSurfaceCurvatureEstimator::maxCurvatureVectorAtTriangle
151 const labelledTri& tri = surface_[triI];
153 vector curv(vector::zero);
154 for(label i=0;i<3;++i)
155 curv += maxCurvatureVector_[tri[i]][patchPositions_(triI, i)];
161 vector triSurfaceCurvatureEstimator::minCurvatureVectorAtTriangle
166 const labelledTri& tri = surface_[triI];
168 vector curv(vector::zero);
169 for(label i=0;i<3;++i)
170 curv += minCurvatureVector_[tri[i]][patchPositions_(triI, i)];
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 } // End namespace Foam
180 // ************************************************************************* //