From 67d8469069521ef11e9c2edd46c706fadb4c36a6 Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 23 Oct 2015 13:52:58 +0200 Subject: [PATCH] + fix bug in B-Spline approximation --- src/Mod/ReverseEngineering/App/ApproxSurface.cpp | 16 ++++++++-------- src/Mod/ReverseEngineering/App/ApproxSurface.h | 14 +++++++------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/Mod/ReverseEngineering/App/ApproxSurface.cpp b/src/Mod/ReverseEngineering/App/ApproxSurface.cpp index 12c7ce259..488a4972a 100644 --- a/src/Mod/ReverseEngineering/App/ApproxSurface.cpp +++ b/src/Mod/ReverseEngineering/App/ApproxSurface.cpp @@ -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(i) / static_cast(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(i) / static_cast(usVMax); _vVMults(i) = 1; } _vVMults(0) = _usVOrder; @@ -885,7 +885,7 @@ void BSplineParameterCorrection::SetVKnots(const std::vector& 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(fabs(fDeltaU)), fMaxDiff); - fMaxDiff = std::max(float(fabs(fDeltaV)), fMaxDiff); + fMaxDiff = std::max(fabs(fDeltaU), fMaxDiff); + fMaxDiff = std::max(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, diff --git a/src/Mod/ReverseEngineering/App/ApproxSurface.h b/src/Mod/ReverseEngineering/App/ApproxSurface.h index 07479de81..96e1cad44 100644 --- a/src/Mod/ReverseEngineering/App/ApproxSurface.h +++ b/src/Mod/ReverseEngineering/App/ApproxSurface.h @@ -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