1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-03 14:10:33 +03:00

# patch V6

This commit is contained in:
msv
2018-08-09 19:11:24 +03:00
parent 3ffdc52821
commit 1b7899d7de
2 changed files with 13 additions and 13 deletions

View File

@@ -67,7 +67,7 @@ static void D2 (const Adaptor2d_Curve2d& C, const Standard_Real U,
static Standard_Real EstimAngl(const gp_Pnt& P1, const gp_Pnt& Pm, const gp_Pnt& P2) static Standard_Real EstimAngl(const gp_Pnt& P1, const gp_Pnt& Pm, const gp_Pnt& P2)
{ {
gp_Vec V1(P1, Pm), V2(Pm, P2); gp_Vec V1(P1, Pm), V2(Pm, P2);
Standard_Real L = V1.Magnitude() * V2.Magnitude(); Standard_Real L = Sqrt(V1.SquareMagnitude() * V2.SquareMagnitude());
// //
if(L > gp::Resolution()) if(L > gp::Resolution())
{ {

View File

@@ -293,13 +293,13 @@ void GCPnts_TangentialDeflection::PerformCurve (const TheCurve& C)
case GeomAbs_BSplineCurve: case GeomAbs_BSplineCurve:
{ {
Handle_TheBSplineCurve BS = C.BSpline() ; Handle_TheBSplineCurve BS = C.BSpline() ;
NbPoints = Max(BS->Degree() + 1, NbPoints); NbPoints = Max(BS->NbPoles(), Max(BS->Degree() + 1, NbPoints));
break; break;
} }
case GeomAbs_BezierCurve: case GeomAbs_BezierCurve:
{ {
Handle_TheBezierCurve BZ = C.Bezier(); Handle_TheBezierCurve BZ = C.Bezier();
NbPoints = Max(BZ->Degree() + 1, NbPoints); NbPoints = Max(BZ->NbPoles(), Max(BZ->Degree() + 1, NbPoints));
break; break;
} }
default: default:
@@ -342,7 +342,7 @@ void GCPnts_TangentialDeflection::PerformCurve (const TheCurve& C)
if(IsLine && IsSequential) if(IsLine && IsSequential)
{ {
gp_XYZ V3 = LastPoint.XYZ() - MiddlePoint.XYZ(); gp_XYZ V3 = LastPoint.XYZ() - MiddlePoint.XYZ();
IsSequential = (V3.Dot(V2) > 0); IsSequential = (V3.Dot(V2) >= 0.0);
} }
} }
} }
@@ -408,6 +408,7 @@ void GCPnts_TangentialDeflection::PerformCurve (const TheCurve& C)
Standard_Boolean MorePoints = Standard_True; Standard_Boolean MorePoints = Standard_True;
Standard_Real U2 = firstu; Standard_Real U2 = firstu;
Standard_Real AngleMax = angularDeflection * 0.5; //car on prend le point milieu Standard_Real AngleMax = angularDeflection * 0.5; //car on prend le point milieu
Standard_Real MinLen2 = myMinLen * myMinLen;
Standard_Integer aIdx[2] = {Intervs.Lower(), Intervs.Lower()}; // Indexes of intervals of U1 and U2, used to handle non-uniform case. Standard_Integer aIdx[2] = {Intervs.Lower(), Intervs.Lower()}; // Indexes of intervals of U1 and U2, used to handle non-uniform case.
Standard_Boolean isNeedToCheck = Standard_False; Standard_Boolean isNeedToCheck = Standard_False;
gp_Pnt aPrevPoint = points.Last(); gp_Pnt aPrevPoint = points.Last();
@@ -451,17 +452,17 @@ void GCPnts_TangentialDeflection::PerformCurve (const TheCurve& C)
V1 = (CurrentPoint.XYZ() - aPrevPoint.XYZ()); //Critere de fleche V1 = (CurrentPoint.XYZ() - aPrevPoint.XYZ()); //Critere de fleche
V2 = (MiddlePoint.XYZ() - aPrevPoint.XYZ()); V2 = (MiddlePoint.XYZ() - aPrevPoint.XYZ());
L1 = V1.Modulus (); L1 = V1.SquareModulus ();
FCoef = (L1 > myMinLen) ? FCoef = (L1 > MinLen2) ?
V1.CrossMagnitude(V2)/(L1*curvatureDeflection) : 0.0; V1.CrossMagnitude(V2)/(Sqrt(L1)*curvatureDeflection) : 0.0;
V1 = (CurrentPoint.XYZ() - MiddlePoint.XYZ()); //Critere d'angle V1 = (CurrentPoint.XYZ() - MiddlePoint.XYZ()); //Critere d'angle
L1 = V1.Modulus (); L1 = V1.SquareModulus ();
L2 = V2.Modulus (); L2 = V2.SquareModulus ();
if (L1 > myMinLen && L2 > myMinLen) if (L1 > MinLen2 && L2 > MinLen2)
{ {
Standard_Real angg = V1.CrossMagnitude(V2) / (L1 * L2); Standard_Real angg = V1.CrossMagnitude(V2) / (Sqrt(L1 * L2));
ACoef = angg / AngleMax; ACoef = angg / AngleMax;
} }
else else
@@ -604,10 +605,9 @@ void GCPnts_TangentialDeflection::PerformCurve (const TheCurve& C)
} }
} }
//Additional check for intervals //Additional check for intervals
Standard_Real MinLen2 = myMinLen * myMinLen;
Standard_Integer MaxNbp = 10 * Nbp; Standard_Integer MaxNbp = 10 * Nbp;
Standard_Real CosAngleMax = sqrt(1 - AngleMax * AngleMax); Standard_Real CosAngleMax = Sqrt(1.0 - AngleMax * AngleMax);
for(i = 1; i < Nbp; ++i) for(i = 1; i < Nbp; ++i)
{ {