1 // Created on: 1994-09-06
2 // Created by: Yves FRICAUD
3 // Copyright (c) 1994-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
18 #include <Geom2d_Curve.hxx>
19 #include <Geom2dAdaptor_Curve.hxx>
20 #include <Geom2dLProp_CurAndInf2d.hxx>
21 #include <Geom2dLProp_NumericCurInf2d.hxx>
22 #include <gp_Circ2d.hxx>
23 #include <gp_Elips2d.hxx>
24 #include <gp_Hypr2d.hxx>
25 #include <gp_Lin2d.hxx>
26 #include <gp_Parab2d.hxx>
27 #include <LProp_AnalyticCurInf.hxx>
28 #include <TColStd_Array1OfReal.hxx>
30 //=======================================================================
31 //function : Geom2dLProp_CurAndInf2d
33 //=======================================================================
34 Geom2dLProp_CurAndInf2d::Geom2dLProp_CurAndInf2d()
39 //=======================================================================
42 //=======================================================================
44 void Geom2dLProp_CurAndInf2d::Perform(const Handle(Geom2d_Curve)& C)
51 //=======================================================================
52 //function : PerformCurExt
54 //=======================================================================
56 void Geom2dLProp_CurAndInf2d::PerformCurExt(const Handle(Geom2d_Curve)& C)
58 isDone = Standard_True;
60 Geom2dAdaptor_Curve CC(C);
61 LProp_AnalyticCurInf AC;
62 Geom2dLProp_NumericCurInf2d NC;
63 GeomAbs_CurveType CType = CC.GetType();
71 AC.Perform(CType,CC.FirstParameter(),CC.LastParameter(),*this);
73 case GeomAbs_Hyperbola:
74 AC.Perform(CType,CC.FirstParameter(),CC.LastParameter(),*this);
76 case GeomAbs_Parabola:
77 AC.Perform(CType,CC.FirstParameter(),CC.LastParameter(),*this);
79 case GeomAbs_BSplineCurve:
80 if (CC.Continuity() >= GeomAbs_C3 ) {
81 NC.PerformCurExt(C,*this);
85 // Decoupage en intervalles C3.
86 isDone = Standard_True;
87 Standard_Integer NbInt = CC.NbIntervals(GeomAbs_C3);
88 TColStd_Array1OfReal Param(1,NbInt+1);
89 CC.Intervals(Param,GeomAbs_C3);
90 for (Standard_Integer i = 1; i <= NbInt; i++) {
91 NC.PerformCurExt(C,Param(i),Param(i+1),*this);
92 if (!NC.IsDone()) {isDone = Standard_False;}
98 NC.PerformCurExt(C,*this);
107 //=======================================================================
108 //function : PerformInf
110 //=======================================================================
112 void Geom2dLProp_CurAndInf2d::PerformInf(const Handle(Geom2d_Curve)& C)
114 isDone = Standard_True;
116 Geom2dAdaptor_Curve CC(C);
117 GeomAbs_CurveType CType = CC.GetType();
118 Geom2dLProp_NumericCurInf2d NC;
125 case GeomAbs_Ellipse:
127 case GeomAbs_Hyperbola:
129 case GeomAbs_Parabola:
131 case GeomAbs_BSplineCurve:
132 if (CC.Continuity() >= GeomAbs_C3 ) {
133 NC.PerformInf(C,*this);
134 isDone = NC.IsDone();
137 // Decoupage en intervalles C3.
138 isDone = Standard_True;
139 Standard_Integer NbInt = CC.NbIntervals(GeomAbs_C3);
140 TColStd_Array1OfReal Param(1,NbInt+1);
141 CC.Intervals(Param,GeomAbs_C3);
143 for (Standard_Integer i = 1; i <= NbInt; i++) {
144 NC.PerformInf(C,Param(i),Param(i+1),*this);
145 if (!NC.IsDone()) {isDone = Standard_False;}
151 NC.PerformInf(C,*this);
152 isDone = NC.IsDone();
159 //=======================================================================
162 //=======================================================================
164 Standard_Boolean Geom2dLProp_CurAndInf2d::IsDone() const