Go to the documentation of this file.
94 "void quadricFitting::calculateCoordinateSystem()"
95 ) <<
"Cannot find a valid coordinate system!" <<
endl;
131 helper[0] =
sqr(
p.x());
132 helper[1] =
sqr(
p.y());
133 helper[2] =
p.x() *
p.y();
137 for(
label rowI=0;rowI<5;++rowI)
139 for(
label colI=rowI;colI<5;++colI)
140 mat[rowI][colI] += helper[rowI] * helper[colI];
142 mat.
source()[rowI] += helper[rowI] *
p.z();
146 for(
label rowI=1;rowI<5;++rowI)
148 for(
label colI=0;colI<rowI;++colI)
149 mat[rowI][colI] = mat[colI][rowI];
151 if(
mag(mat[rowI][rowI]) < SMALL )
152 mat[rowI][rowI] = SMALL;
162 while( iteration++ < 10 )
199 template<
class ListType>
204 const ListType& otherPoints
212 transformedPoints_(),
215 otherPoints_.setSize(otherPoints.size());
217 otherPoints_[i] = otherPoints[i];
219 if(
magSqr(normal_) < VSMALL )
223 "template<class ListType>\n"
224 "inline quadricFitting::quadricFitting"
225 "(const point& origin, const vector normal,"
226 " const ListType& otherPoints)"
227 ) <<
"Cannot construct the quadric surface for point "
228 << origin_ <<
" because the normal does not exist!"
229 <<
"\nThis indicates that the input"
236 normal_ /=
mag(normal_);
243 template<
class ListType>
247 const ListType& otherPoints
255 transformedPoints_(),
258 otherPoints_.setSize(otherPoints.size());
260 otherPoints_[i] = otherPoints[i];
262 calculateNormalVector();
scalar meanCurvature() const
Return mean curvature.
DynList< point > transformedPoints_
transformed coordinates of other points
dimensionedSymmTensor symm(const dimensionedSymmTensor &dt)
point nearestPoint(const point &p) const
Return nearest point in the plane for the given point.
A simple square matrix solver with scalar coefficients.
void calculateCoordinateSystem()
calculate transformed coordinate system
#define forAll(list, i)
Loop across all elements in list.
vector minCurvatureVector() const
Return min curvature vector.
void calculateQuadricCoeffs()
calculate coefficients of the quadric surface fit
void calculateNormalVector()
initial estimate of the normal vector
dimensionedScalar sin(const dimensionedScalar &ds)
vector normal_
normal vector at the origin
Field< Type > LUsolve() const
Solve the matrix using LU decomposition with pivoting.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< scalar > mag(const dimensioned< Type > &)
scalar gaussianCurvature() const
Return Gaussian curvature.
Field< Type > & source()
Return access to the source.
Geometric class that creates a 2D plane and can return the intersection point between a line and the ...
vector vecY_
y-coordinate vector for the transformed coordinate system
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
vector vecX_
x-coordinate vector for the transformed coordinate system
vector eigenVector(const tensor &, const scalar lambda)
dimensionedVector eigenValues(const dimensionedTensor &dt)
tmp< DimensionedField< scalar, GeoMesh > > stabilise(const DimensionedField< scalar, GeoMesh > &dsf, const dimensioned< scalar > &ds)
scalarField coefficients_
coefficients of the quadric surface
point origin_
seed point for fitting the quadric surface
const vector & normal() const
Return surface normal.
static const SymmTensor zero
quadricFitting(const point &, const vector, const ListType &)
Construct from point, normal, and neighbouring points.
scalar minCurvature() const
Return min curvature.
errorManipArg< error, int > exit(error &err, const int errNo=1)
DynList< point > otherPoints_
other points
dimensionedSymmTensor sqr(const dimensionedVector &dv)
dimensionedScalar sqrt(const dimensionedScalar &ds)
void setSize(const label)
Reset size of List.
dimensionedScalar atan(const dimensionedScalar &ds)
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
vector maxCurvatureVector() const
Return max curvature vector.
scalar maxCurvature() const
Return max curvature.
dimensioned< scalar > magSqr(const dimensioned< Type > &)
A normal distribution model.
dimensionedScalar cos(const dimensionedScalar &ds)