1 // Created on: 1993-04-07
2 // Created by: Laurent BUCHARD
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
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.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16 
17 #ifndef _IntCurveSurface_ThePolygonOfHInter_HeaderFile
18 #define _IntCurveSurface_ThePolygonOfHInter_HeaderFile
19 
20 #include <Adaptor3d_Curve.hxx>
21 #include <Bnd_Box.hxx>
22 #include <TColgp_Array1OfPnt.hxx>
23 #include <TColStd_HArray1OfReal.hxx>
24 #include <TColStd_Array1OfReal.hxx>
25 class Standard_OutOfRange;
26 class IntCurveSurface_TheHCurveTool;
27 class Bnd_Box;
28 class gp_Pnt;
29 
30 class IntCurveSurface_ThePolygonOfHInter
31 {
32 public:
33 
34   DEFINE_STANDARD_ALLOC
35 
36 
37   Standard_EXPORT IntCurveSurface_ThePolygonOfHInter(const Handle(Adaptor3d_Curve)& Curve, const Standard_Integer NbPnt);
38 
39   Standard_EXPORT IntCurveSurface_ThePolygonOfHInter(const Handle(Adaptor3d_Curve)& Curve, const Standard_Real U1, const Standard_Real U2, const Standard_Integer NbPnt);
40 
41   Standard_EXPORT IntCurveSurface_ThePolygonOfHInter(const Handle(Adaptor3d_Curve)& Curve, const TColStd_Array1OfReal& Upars);
42 
43   //! Give the bounding box of the polygon.
Bounding() const44   const Bnd_Box& Bounding() const { return TheBnd; }
45 
DeflectionOverEstimation() const46   Standard_Real DeflectionOverEstimation() const { return TheDeflection; }
47 
SetDeflectionOverEstimation(const Standard_Real x)48   void SetDeflectionOverEstimation (const Standard_Real x)
49   {
50     TheDeflection = x;
51     TheBnd.Enlarge (TheDeflection);
52   }
53 
Closed(const Standard_Boolean flag)54   void Closed (const Standard_Boolean flag) { ClosedPolygon = flag; }
55 
Closed() const56   Standard_Boolean Closed() const { return Standard_False; } // -- Voir si le cas Closed est traitable
57 
58   //! Give the number of Segments in the polyline.
NbSegments() const59   Standard_Integer NbSegments() const { return NbPntIn - 1; }
60 
61   //! Give the point of range Index in the Polygon.
BeginOfSeg(const Standard_Integer theIndex) const62   const gp_Pnt& BeginOfSeg (const Standard_Integer theIndex) const { return ThePnts (theIndex); }
63 
64   //! Give the point of range Index in the Polygon.
EndOfSeg(const Standard_Integer theIndex) const65   const gp_Pnt& EndOfSeg (const Standard_Integer theIndex) const { return ThePnts (theIndex + 1); }
66 
67   //! Returns the parameter (On the curve)
68   //! of the first point of the Polygon
InfParameter() const69   Standard_Real InfParameter() const { return Binf; }
70 
71   //! Returns the parameter (On the curve)
72   //! of the last point of the Polygon
SupParameter() const73   Standard_Real SupParameter() const { return Bsup; }
74 
75   //! Give an approximation of the parameter on the curve
76   //! according to the discretization of the Curve.
77   Standard_EXPORT Standard_Real ApproxParamOnCurve (const Standard_Integer Index, const Standard_Real ParamOnLine) const;
78 
79   Standard_EXPORT void Dump() const;
80 
81 protected:
82 
83   Standard_EXPORT void Init (const Handle(Adaptor3d_Curve)& Curve);
84 
85   Standard_EXPORT void Init (const Handle(Adaptor3d_Curve)& Curve, const TColStd_Array1OfReal& Upars);
86 
87 private:
88 
89   Bnd_Box TheBnd;
90   Standard_Real TheDeflection;
91   Standard_Integer NbPntIn;
92   TColgp_Array1OfPnt ThePnts;
93   Standard_Boolean ClosedPolygon;
94   Standard_Real Binf;
95   Standard_Real Bsup;
96   Handle(TColStd_HArray1OfReal) myParams;
97 
98 };
99 
100 #endif // _IntCurveSurface_ThePolygonOfHInter_HeaderFile
101