+ get initial plane fit from B-Spline fit if required

This commit is contained in:
wmayer 2015-11-06 00:27:33 +01:00
parent 25fd2adb03
commit 8645d56acf
2 changed files with 32 additions and 0 deletions

View File

@ -693,6 +693,22 @@ Base::Vector3d ParameterCorrection::GetGravityPoint() const
return Base::Vector3d(x/ulSize, y/ulSize, z/ulSize);
}
void ParameterCorrection::ProjectControlPointsOnPlane()
{
Base::Vector3d base = GetGravityPoint();
for (unsigned j=0;j<_usUCtrlpoints;j++) {
for (unsigned k=0;k<_usVCtrlpoints;k++) {
gp_Pnt pole = _vCtrlPntsOfSurf(j,k);
Base::Vector3d pnt(pole.X(), pole.Y(), pole.Z());
pnt.ProjToPlane(base, _clW);
pole.SetX(pnt.x);
pole.SetY(pnt.y);
pole.SetZ(pnt.z);
_vCtrlPntsOfSurf(j,k) = pole;
}
}
}
Handle(Geom_BSplineSurface) ParameterCorrection::CreateSurface(const TColgp_Array1OfPnt& points,
int iIter,
bool bParaCor,
@ -704,6 +720,7 @@ Handle(Geom_BSplineSurface) ParameterCorrection::CreateSurface(const TColgp_Arra
delete _pvcUVParam;
_pvcUVParam = NULL;
}
_pvcPoints = new TColgp_Array1OfPnt(points.Lower(), points.Upper());
*_pvcPoints = points;
_pvcUVParam = new TColgp_Array1OfPnt2d(points.Lower(), points.Upper());
@ -713,6 +730,16 @@ Handle(Geom_BSplineSurface) ParameterCorrection::CreateSurface(const TColgp_Arra
if (!DoInitialParameterCorrection(fSizeFactor))
return NULL;
// Erzeuge die Approximations-Ebene als B-Spline-Flaeche
if (iIter < 0) {
bParaCor = false;
ProjectControlPointsOnPlane();
}
// Keine weiteren Parameterkorrekturen
else if (iIter == 0) {
bParaCor = false;
}
if (bParaCor)
DoParameterCorrection(iIter);

View File

@ -274,6 +274,11 @@ protected:
*/
virtual void CalcEigenvectors();
/**
* Projiziert die Kontrollpunkte auf die Fit-Ebene
*/
void ProjectControlPointsOnPlane();
/**
* Berechnet eine initiale Flaeche zu Beginn des Algorithmus. Dazu wird die Ausgleichsebene zu der
* Punktwolke berechnet.