// Created on: 1993-06-24
// Created by: Jean Yves LEBEY
// Copyright (c) 1993-1999 Matra Datavision
-// Copyright (c) 1999-2012 OPEN CASCADE SAS
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
+// This file is part of Open CASCADE Technology software library.
//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+// 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.
//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
-#include <TopOpeBRepTool_CurveTool.ixx>
-
-#include <ProjLib_ProjectedCurve.hxx>
+#include <BRep_Tool.hxx>
+#include <BRepAdaptor_HSurface.hxx>
+#include <BRepAdaptor_Surface.hxx>
#include <BRepApprox_Approx.hxx>
#include <BRepApprox_ApproxLine.hxx>
-#include <TopoDS.hxx>
-#include <TopoDS_Face.hxx>
-#include <Geom_BSplineCurve.hxx>
-#include <Geom2d_Line.hxx>
+#include <BRepTools.hxx>
+#include <ElSLib.hxx>
+#include <gce_MakeCirc.hxx>
+#include <gce_MakeLin.hxx>
+#include <gce_MakeLin2d.hxx>
+#include <Geom2d_BSplineCurve.hxx>
#include <Geom2d_Circle.hxx>
+#include <Geom2d_Curve.hxx>
#include <Geom2d_Ellipse.hxx>
-#include <Geom2d_Parabola.hxx>
#include <Geom2d_Hyperbola.hxx>
-#include <Geom2d_BSplineCurve.hxx>
-#include <TColStd_Array1OfReal.hxx>
-#include <GeomLib_CheckBSplineCurve.hxx>
-#include <GeomLib_Check2dBSplineCurve.hxx>
-#include <TColStd_Array1OfInteger.hxx>
-#include <BRepAdaptor_Surface.hxx>
+#include <Geom2d_Line.hxx>
+#include <Geom2d_Parabola.hxx>
+#include <Geom_BSplineCurve.hxx>
+#include <Geom_Curve.hxx>
+#include <Geom_RectangularTrimmedSurface.hxx>
+#include <Geom_Surface.hxx>
+#include <GeomAbs_SurfaceType.hxx>
#include <GeomAdaptor_Curve.hxx>
-#include <BRepAdaptor_HSurface.hxx>
#include <GeomAdaptor_HCurve.hxx>
-#include <GeomAbs_SurfaceType.hxx>
+#include <GeomLib_Check2dBSplineCurve.hxx>
+#include <GeomLib_CheckBSplineCurve.hxx>
+#include <GeomTools_Curve2dSet.hxx>
+#include <gp_Lin.hxx>
+#include <gp_Lin2d.hxx>
#include <gp_Pln.hxx>
#include <gp_Pnt2d.hxx>
-#include <ElSLib.hxx>
+#include <gp_Vec.hxx>
+#include <OSD_Chronometer.hxx>
+#include <Precision.hxx>
+#include <ProjLib_ProjectedCurve.hxx>
#include <Standard_NotImplemented.hxx>
#include <Standard_ProgramError.hxx>
-#include <OSD_Chronometer.hxx>
-
-#include <GeomTools_Curve2dSet.hxx>
#include <TColStd_Array1OfBoolean.hxx>
-#include <gp_Lin.hxx>
-#include <gce_MakeLin.hxx>
-#include <gp_Lin2d.hxx>
-#include <gce_MakeLin2d.hxx>
-#include <BRepTools.hxx>
-#include <Precision.hxx>
-#include <gce_MakeCirc.hxx>
-#include <gp_Vec.hxx>
-//#include <Approx.hxx>
-#include <Geom_Surface.hxx>
+#include <TColStd_Array1OfInteger.hxx>
+#include <TColStd_Array1OfReal.hxx>
#include <TopLoc_Location.hxx>
-#include <Geom_RectangularTrimmedSurface.hxx>
-#include <BRep_Tool.hxx>
-
-Standard_IMPORT Standard_Boolean TopOpeBRepTool_GettracePCURV();
-Standard_IMPORT Standard_Boolean TopOpeBRepTool_GettraceCHKBSPL();
+#include <TopoDS.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopOpeBRepTool_CurveTool.hxx>
+#include <TopOpeBRepTool_GeomTool.hxx>
-#ifdef DEB
+//#include <Approx.hxx>
+#ifdef OCCT_DEBUG
#include <TopOpeBRepTool_KRO.hxx>
TOPKRO KRO_CURVETOOL_APPRO("approximation");
-Standard_IMPORT Standard_Boolean TopOpeBRepTool_GettraceKRO();
+extern Standard_Boolean TopOpeBRepTool_GettraceKRO();
+extern Standard_Boolean TopOpeBRepTool_GettracePCURV();
+extern Standard_Boolean TopOpeBRepTool_GettraceCHKBSPL();
#endif
//#define DRAW
//#define IFV
#define CurveImprovement
#ifdef DRAW
#include <DrawTrSurf.hxx>
+#include <Geom2d_Curve.hxx>
static Standard_Integer NbCalls = 0;
#endif
//=======================================================================
case GeomAbs_Parabola : C2D = new Geom2d_Parabola(PC.Parabola()); break;
case GeomAbs_Hyperbola : C2D = new Geom2d_Hyperbola(PC.Hyperbola()); break;
case GeomAbs_BSplineCurve : C2D = PC.BSpline(); break;
- case GeomAbs_BezierCurve : case GeomAbs_OtherCurve : default :
+ default :
Standard_NotImplemented::Raise("CurveTool::MakePCurve");
break;
}
Standard_Boolean CompPC1 = myGeomTool.CompPC1();
Standard_Boolean CompPC2 = myGeomTool.CompPC2();
Standard_Real tol3d,tol2d;
- Standard_Boolean RelativeTol;
- myGeomTool.GetTolerances(tol3d,tol2d,RelativeTol);
+ myGeomTool.GetTolerances(tol3d,tol2d);
Standard_Integer NbPntMax = myGeomTool.NbPntMax();
-#ifdef DEB
+#ifdef OCCT_DEBUG
if (TopOpeBRepTool_GettraceKRO()) KRO_CURVETOOL_APPRO.Start();
#endif
Standard_Integer iparmin = (Standard_Integer)parmin;
Standard_Integer iparmax = (Standard_Integer)parmax;
- Handle(Geom_BSplineCurve)& HC3D = *((Handle(Geom_BSplineCurve)*)&C3D);
- Handle(Geom2d_BSplineCurve)& HPC1 = *((Handle(Geom2d_BSplineCurve)*)&PC1);
- Handle(Geom2d_BSplineCurve)& HPC2 = *((Handle(Geom2d_BSplineCurve)*)&PC2);
+ Handle(Geom_BSplineCurve) HC3D (Handle(Geom_BSplineCurve)::DownCast (C3D));
+ Handle(Geom2d_BSplineCurve) HPC1 (Handle(Geom2d_BSplineCurve)::DownCast (PC1));
+ Handle(Geom2d_BSplineCurve) HPC2 (Handle(Geom2d_BSplineCurve)::DownCast (PC2));
//--------------------- IFV - "improving" initial curves
#ifdef CurveImprovement
if(CompPC1) Polpc1(NbPol) = PolPC1(nbpol);
if(CompPC2) Polpc2(NbPol) = PolPC2(nbpol);
- HC3D = new Geom_BSplineCurve(Polc3d, knots, mults, 1);
- if(CompPC1) HPC1 = new Geom2d_BSplineCurve(Polpc1, knots, mults, 1);
- if(CompPC2) HPC2 = new Geom2d_BSplineCurve(Polpc2, knots, mults, 1);
+ const_cast<Handle(Geom_Curve)&>(C3D) = new Geom_BSplineCurve(Polc3d, knots, mults, 1);
+ if(CompPC1) const_cast<Handle(Geom2d_Curve)&>(PC1) = new Geom2d_BSplineCurve(Polpc1, knots, mults, 1);
+ if(CompPC2) const_cast<Handle(Geom2d_Curve)&>(PC2) = new Geom2d_BSplineCurve(Polpc2, knots, mults, 1);
iparmax = NbPol;
#ifdef IFV
sprintf(name,"C3Dmod_%d",NbCalls);
nm = &name[0];
- DrawTrSurf::Set(nm, HC3D);
+ DrawTrSurf::Set(nm, C3D);
sprintf(name,"PC1mod_%d",NbCalls);
nm = &name[0];
- DrawTrSurf::Set(nm, HPC1);
+ DrawTrSurf::Set(nm, PC1);
sprintf(name,"PC2mod_%d",NbCalls);
nm = &name[0];
- DrawTrSurf::Set(nm, HPC2);
+ DrawTrSurf::Set(nm, PC2);
#endif
}
Handle(BRepApprox_ApproxLine) AL;
AL = new BRepApprox_ApproxLine(HC3D,HPC1,HPC2);
- Approx.SetParameters(tol3d,tol2d,RelativeTol,degmin,degmax,nitmax,NbPntMax,withtangency,
+ Approx.SetParameters(tol3d,tol2d,degmin,degmax,nitmax,NbPntMax,withtangency,
parametrization);
if (CompC3D && CompPC1 && BAS1.GetType() == GeomAbs_Plane) {
Standard_Boolean bf, bl;
- const Handle(Geom_BSplineCurve)& Curve = Handle(Geom_BSplineCurve)::DownCast(C3Dnew);
+ Handle(Geom_BSplineCurve) Curve (Handle(Geom_BSplineCurve)::DownCast(C3Dnew));
if(!Curve.IsNull()) {
GeomLib_CheckBSplineCurve cbsc(Curve, 1.e-7, 0.1);
cbsc.NeedTangentFix(bf, bl);
-#ifdef DEB
+#ifdef OCCT_DEBUG
if (TopOpeBRepTool_GettraceCHKBSPL()) {
if(bf || bl) {
cout<<"Problem orientation GeomLib_CheckBSplineCurve : First = "<<bf;
cbsc.FixTangent(bf, bl);
}
- const Handle(Geom2d_BSplineCurve)& Curve2df = Handle(Geom2d_BSplineCurve)::DownCast(PC1new);
+ Handle(Geom2d_BSplineCurve) Curve2df (Handle(Geom2d_BSplineCurve)::DownCast(PC1new));
if(!Curve2df.IsNull()) {
GeomLib_Check2dBSplineCurve cbsc2df(Curve2df, 1.e-7, 0.1);
cbsc2df.NeedTangentFix(bf, bl);
-#ifdef DEB
+#ifdef OCCT_DEBUG
if (TopOpeBRepTool_GettraceCHKBSPL()) {
if(bf || bl) {
cout<<"Problem orientation GeomLib_CheckBSplineCurve : First = "<<bf;
cbsc2df.FixTangent(bf, bl);
}
- const Handle(Geom2d_BSplineCurve)& Curve2ds = Handle(Geom2d_BSplineCurve)::DownCast(PC2new);
+ Handle(Geom2d_BSplineCurve) Curve2ds (Handle(Geom2d_BSplineCurve)::DownCast(PC2new));
if(!Curve2ds.IsNull()) {
GeomLib_Check2dBSplineCurve cbsc2ds(Curve2ds, 1.e-7, 0.1);
cbsc2ds.NeedTangentFix(bf, bl);
-#ifdef DEB
+#ifdef OCCT_DEBUG
if (TopOpeBRepTool_GettraceCHKBSPL()) {
if(bf || bl) {
cout<<"Problem orientation GeomLib_CheckBSplineCurve : First = "<<bf;
cbsc2ds.FixTangent(bf, bl);
}
-#ifdef DEB
+#ifdef OCCT_DEBUG
if (TopOpeBRepTool_GettraceKRO()) KRO_CURVETOOL_APPRO.Stop();
#endif
// cout << "MakeCurves end" << endl;
}
}
-#ifdef DEB
+#ifdef OCCT_DEBUG
if (TopOpeBRepTool_GettracePCURV()) {
cout<<"--- IsProjectable : ";
if (projectable) cout<<"projectable"<<endl;