-// File Approx_ComputeLine.gxx
+// Copyright (c) 1995-1999 Matra Datavision
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
#include <Approx_ParametrizationType.hxx>
#include Approx_ParLeastSquareOfMyGradient_hxx
#include <stdio.h>
-#ifdef DEB
+#ifdef OCCT_DEBUG
static Standard_Boolean mydebug = Standard_False;
#include <Geom_BezierCurve.hxx>
static Standard_Integer nbappel = 0;
Standard_Integer i;
Standard_Integer nbpoles = C.NbPoles();
- Standard_Integer deg = C.Degree();
Handle(Geom_BezierCurve) BSp;
Handle(Geom2d_BezierCurve) BSp2d;
void Approx_ComputeLine::Perform(const MultiLine& Line)
{
-#ifdef DEB
+#ifdef OCCT_DEBUG
if (mydebug) DUMP(Line);
#endif
if (!myIsClear)
TheMultiCurve = AppParCurves_MultiCurve();
alldone = Compute(Line, myfirstpt, mylastpt, TheParam, thetol3d, thetol2d);
if(!alldone && TheMultiCurve.NbCurves() > 0) {
-#ifdef DEB
+#ifdef OCCT_DEBUG
if (mydebug) DUMP(TheMultiCurve);
#endif
myMultiCurves.Append(TheMultiCurve);
// ========================================
GoUp = Standard_False;
Ok = Standard_True;
- Standard_Boolean FailOnPointsAdded = Standard_False;
if (MyStatus == Approx_PointsAdded) {
// Appel recursif du decoupage:
GoUp = Standard_True;
//-- Si MakeML a echoue on retourne une ligne vide
if ((nbpdsotherligne == 0) || myMultiLineNb >= 3)
{
- FailOnPointsAdded = Standard_True;
//-- cout<<" ** ApproxComputeLine MakeML Echec ** LBR lbr "<<endl;
if (myfirstpt == mylastpt) break; // Pour etre sur de ne pas
// planter la station !!
myMultiCurves.Clear();
return;
}
-#ifdef DEB
+#ifdef OCCT_DEBUG
if (mydebug) DUMP(TheMultiCurve);
#endif
myMultiCurves.Append(TheMultiCurve);
myMultiCurves.Clear();
return;
}
-#ifdef DEB
+#ifdef OCCT_DEBUG
if (mydebug) DUMP(TheMultiCurve);
#endif
myMultiCurves.Append(TheMultiCurve);
const Standard_Integer lastP,
math_Vector& TheParameters) const
{
- Standard_Integer i, j, Nbp, nbP2d, nbP3d;
+ Standard_Integer i, j, nbP2d, nbP3d;
Standard_Real dist;
gp_Pnt P1, P2;
gp_Pnt2d P12d, P22d;
- Nbp = lastP-firstP+1;
if (Par == Approx_ChordLength || Par == Approx_Centripetal) {
nbP3d = LineTool::NbP3d(Line);
if (TheTol3d <= mytol3d && TheTol2d <= mytol2d) {
// Stockage de la multicurve approximee.
tolreached = Standard_True;
-#ifdef DEB
+#ifdef OCCT_DEBUG
if (mydebug) DUMP(mySCU);
#endif
myMultiCurves.Append(mySCU);
gp_Vec2d V12d, V22d;
gp_Pnt P1, P2;
gp_Pnt2d P12d, P22d;
- Standard_Boolean Tangent1, Tangent2, Parallel, mydone= Standard_False;
+ Standard_Boolean Tangent1, Tangent2, mydone= Standard_False;
+#ifdef OCCT_DEBUG
+ Standard_Boolean Parallel;
+#endif
Standard_Integer myfirstpt = firstpt, mylastpt = lastpt;
Standard_Integer nbp = lastpt-firstpt+1, Kopt = 0;
- AppParCurves_Constraint FirstC, LastC;
- FirstC = AppParCurves_PassPoint;
- LastC = AppParCurves_PassPoint;
math_Vector Para(firstpt, lastpt);
Parameters(Line, firstpt, lastpt, Para);
if (nbp == 2) {
// S il n y a que 2 points, on verifie quand meme que les tangentes sont
// alignees.
+#ifdef OCCT_DEBUG
Parallel = Standard_True;
+#endif
if (Tangent1) {
for (i = 1; i <= nbP3d; i++) {
gp_Vec PVec(tabP1(i), tabP2(i));
V13d = tabV1(i);
if (!PVec.IsParallel(V13d, Precision::Angular())) {
+#ifdef OCCT_DEBUG
Parallel = Standard_False;
+#endif
break;
}
}
gp_Vec2d PVec2d(tabP12d(i), tabP22d(i));
V12d = tabV12d(i);
if (!PVec2d.IsParallel(V12d, Precision::Angular())) {
+#ifdef OCCT_DEBUG
Parallel = Standard_False;
+#endif
break;
}
}
gp_Vec PVec(tabP1(i), tabP2(i));
V23d = tabV2(i);
if (!PVec.IsParallel(V23d, Precision::Angular())) {
+#ifdef OCCT_DEBUG
Parallel = Standard_False;
+#endif
break;
}
}
gp_Vec2d PVec2d(tabP12d(i), tabP22d(i));
V22d = tabV22d(i);
if (!PVec2d.IsParallel(V22d, Precision::Angular())) {
+#ifdef OCCT_DEBUG
Parallel = Standard_False;
+#endif
break;
}
}
}
-#ifdef DEB
+#ifdef OCCT_DEBUG
if (!Parallel) {
if (mydebug) cout <<"droite mais tangentes pas vraiment paralleles!!"<< endl;
}
mydone = Standard_True;
// Stockage de la multicurve approximee.
tolreached = Standard_True;
-#ifdef DEB
+#ifdef OCCT_DEBUG
if (mydebug) DUMP(mySCU);
#endif
myMultiCurves.Append(mySCU);
// Stockage de la multicurve approximee.
tolreached = Standard_True;
-#ifdef DEB
+#ifdef OCCT_DEBUG
if (mydebug) DUMP(mySCU);
#endif
myMultiCurves.Append(mySCU);
tol2d = Tolers2d.Value(Index);
}
-void Approx_ComputeLine::Parametrization(Approx_ParametrizationType& partype) const
+Approx_ParametrizationType Approx_ComputeLine::Parametrization() const
{
- partype = Par;
+ return Par;
}