+ fix bug in B-Spline approximation

This commit is contained in:
wmayer 2015-10-23 13:52:58 +02:00
parent 1c90c3794d
commit 67d8469069
2 changed files with 15 additions and 15 deletions

View File

@ -682,7 +682,7 @@ bool ParameterCorrection::GetUVParameters(double fSizeFactor)
(*_pvcPoints)(ii).Y(),
(*_pvcPoints)(ii).Z()));
vcProjPts.push_back(Base::Vector2D(clProjPnt.X(), clProjPnt.Y()));
clBBox.Add(Base::Vector2D(clProjPnt.X(), clProjPnt.Y()));
clBBox.Add(Base::Vector2D(clProjPnt.X(), clProjPnt.Y()));
}
if ((clBBox.fMaxX == clBBox.fMinX) || (clBBox.fMaxY == clBBox.fMinY))
@ -825,7 +825,7 @@ void BSplineParameterCorrection::Init()
// u-Richtung
for (int i=0;i<=usUMax; i++)
{
_vUKnots(i) = i / usUMax;
_vUKnots(i) = static_cast<double>(i) / static_cast<double>(usUMax);
_vUMults(i) = 1;
}
_vUMults(0) = _usUOrder;
@ -833,7 +833,7 @@ void BSplineParameterCorrection::Init()
// v-Richtung
for (int i=0; i<=usVMax; i++)
{
_vVKnots(i) = i / usVMax;
_vVKnots(i) = static_cast<double>(i) / static_cast<double>(usVMax);
_vVMults(i) = 1;
}
_vVMults(0) = _usVOrder;
@ -885,7 +885,7 @@ void BSplineParameterCorrection::SetVKnots(const std::vector<double>& afKnots)
void BSplineParameterCorrection::DoParameterCorrection(unsigned short usIter)
{
int i=0;
float fMaxDiff=0.0f, fMaxScalar=1.0f;
double fMaxDiff=0.0, fMaxScalar=1.0;
double fWeight = _fSmoothInfluence;
Base::SequencerLauncher seq("Calc surface...", usIter*_pvcPoints->Length());
@ -924,7 +924,7 @@ void BSplineParameterCorrection::DoParameterCorrection(unsigned short usIter)
{
ErrorVec.Normalize();
if(fabs(clNormal*ErrorVec) < fMaxScalar)
fMaxScalar = (float)fabs(clNormal*ErrorVec);
fMaxScalar = fabs(clNormal*ErrorVec);
}
fDeltaU = ( (P-X) * Xu ) / ( (P-X)*Xuu - Xu*Xu );
@ -942,8 +942,8 @@ void BSplineParameterCorrection::DoParameterCorrection(unsigned short usIter)
{
(*_pvcUVParam)(ii).SetX(fU);
(*_pvcUVParam)(ii).SetY(fV);
fMaxDiff = std::max<float>(float(fabs(fDeltaU)), fMaxDiff);
fMaxDiff = std::max<float>(float(fabs(fDeltaV)), fMaxDiff);
fMaxDiff = std::max<double>(fabs(fDeltaU), fMaxDiff);
fMaxDiff = std::max<double>(fabs(fDeltaV), fMaxDiff);
}
seq.next();
@ -1214,7 +1214,7 @@ void BSplineParameterCorrection::CalcThirdSmoothMatrix(Base::SequencerLauncher&
void BSplineParameterCorrection::EnableSmoothing(bool bSmooth, double fSmoothInfl)
{
EnableSmoothing(bSmooth, fSmoothInfl, 1.0f, 0.0f, 0.0f);
EnableSmoothing(bSmooth, fSmoothInfl, 1.0, 0.0, 0.0);
}
void BSplineParameterCorrection::EnableSmoothing(bool bSmooth, double fSmoothInfl,

View File

@ -319,13 +319,13 @@ protected:
bool _bGetUVDir; //! Stellt fest, ob u/v-Richtung vorgegeben wird
bool _bSmoothing; //! Glättung verwenden
double _fSmoothInfluence; //! Einfluß der Glättung
unsigned short _usUOrder; //! Ordnung in u-Richtung
unsigned short _usVOrder; //! Ordnung in v-Richtung
unsigned short _usUCtrlpoints; //! Anzahl der Kontrollpunkte in u-Richtung
unsigned short _usVCtrlpoints; //! Anzahl der Kontrollpunkte in v-Richtung
Base::Vector3d _clU; //! u-Richtung
Base::Vector3d _clV; //! v-Richtung
Base::Vector3d _clW; //! w-Richtung (senkrecht zu u-und w-Richtung)
unsigned short _usUOrder; //! Ordnung in u-Richtung
unsigned short _usVOrder; //! Ordnung in v-Richtung
unsigned short _usUCtrlpoints; //! Anzahl der Kontrollpunkte in u-Richtung
unsigned short _usVCtrlpoints; //! Anzahl der Kontrollpunkte in v-Richtung
Base::Vector3d _clU; //! u-Richtung
Base::Vector3d _clV; //! v-Richtung
Base::Vector3d _clW; //! w-Richtung (senkrecht zu u-und w-Richtung)
TColgp_Array1OfPnt* _pvcPoints; //! Punktliste der Rohdaten
TColgp_Array1OfPnt2d* _pvcUVParam; //! Parameterwerte zu den Punkten aus der Liste
TColgp_Array2OfPnt _vCtrlPntsOfSurf; //! Array von Kontrollpunkten