0031642: Visualization - crash in Graphic3d_Structure::SetVisual() on redisplaying...
[occt.git] / src / HLRBRep / HLRBRep_CurveTool.hxx
1 // Created on: 1995-07-17
2 // Created by: Modelistation
3 // Copyright (c) 1995-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 _HLRBRep_CurveTool_HeaderFile
18 #define _HLRBRep_CurveTool_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <Standard_Real.hxx>
25 #include <Standard_Address.hxx>
26 #include <GeomAbs_Shape.hxx>
27 #include <Standard_Integer.hxx>
28 #include <TColStd_Array1OfReal.hxx>
29 #include <Standard_Boolean.hxx>
30 #include <gp_Pnt2d.hxx>
31 #include <gp_Vec2d.hxx>
32 #include <GeomAbs_CurveType.hxx>
33 #include <gp_Lin2d.hxx>
34 #include <gp_Circ2d.hxx>
35 #include <gp_Elips2d.hxx>
36 #include <gp_Hypr2d.hxx>
37 #include <gp_Parab2d.hxx>
38 class Standard_OutOfRange;
39 class Standard_NoSuchObject;
40 class Standard_DomainError;
41 class gp_Pnt2d;
42 class gp_Vec2d;
43 class Geom2d_BezierCurve;
44 class Geom2d_BSplineCurve;
45
46
47
48 class HLRBRep_CurveTool 
49 {
50 public:
51
52   DEFINE_STANDARD_ALLOC
53
54   
55     static Standard_Real FirstParameter (const Standard_Address C);
56   
57     static Standard_Real LastParameter (const Standard_Address C);
58   
59     static GeomAbs_Shape Continuity (const Standard_Address C);
60   
61   //! Returns  the number  of  intervals for  continuity
62   //! <S>. May be one if Continuity(myclass) >= <S>
63     static Standard_Integer NbIntervals (const Standard_Address C);
64   
65   //! Stores in <T> the  parameters bounding the intervals
66   //! of continuity <S>.
67   //!
68   //! The array must provide  enough room to  accomodate
69   //! for the parameters. i.e. T.Length() > NbIntervals()
70     static void Intervals (const Standard_Address C, TColStd_Array1OfReal& T);
71   
72   //! output the bounds of interval of index <Index>
73   //! used if Type == Composite.
74     static void GetInterval (const Standard_Address C, const Standard_Integer Index, const TColStd_Array1OfReal& Tab, Standard_Real& U1, Standard_Real& U2);
75   
76     static Standard_Boolean IsClosed (const Standard_Address C);
77   
78     static Standard_Boolean IsPeriodic (const Standard_Address C);
79   
80     static Standard_Real Period (const Standard_Address C);
81   
82   //! Computes the point of parameter U on the curve.
83     static gp_Pnt2d Value (const Standard_Address C, const Standard_Real U);
84   
85   //! Computes the point of parameter U on the curve.
86     static void D0 (const Standard_Address C, const Standard_Real U, gp_Pnt2d& P);
87   
88   //! Computes the point  of parameter U on the curve
89   //! with its first derivative.
90   //! Raised if the continuity of the current interval
91   //! is not C1.
92     static void D1 (const Standard_Address C, const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V);
93   
94
95   //! Returns the point P of parameter U, the first and second
96   //! derivatives V1 and V2.
97   //! Raised if the continuity of the current interval
98   //! is not C2.
99     static void D2 (const Standard_Address C, const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2);
100   
101
102   //! Returns the point P of parameter U, the first, the second
103   //! and the third derivative.
104   //! Raised if the continuity of the current interval
105   //! is not C3.
106     static void D3 (const Standard_Address C, const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2, gp_Vec2d& V3);
107   
108
109   //! The returned vector gives the value of the derivative for the
110   //! order of derivation N.
111   //! Raised if the continuity of the current interval
112   //! is not CN.
113   //! Raised if N < 1.
114     static gp_Vec2d DN (const Standard_Address C, const Standard_Real U, const Standard_Integer N);
115   
116   //! Returns the parametric  resolution corresponding
117   //! to the real space resolution <R3d>.
118     static Standard_Real Resolution (const Standard_Address C, const Standard_Real R3d);
119   
120   //! Returns  the  type of the   curve  in the  current
121   //! interval :   Line,   Circle,   Ellipse, Hyperbola,
122   //! Parabola, BezierCurve, BSplineCurve, OtherCurve.
123     static GeomAbs_CurveType GetType (const Standard_Address C);
124   
125   //! Returns  the  type of the   curve  in the  current
126   //! interval :   Line,   Circle,   Ellipse, Hyperbola,
127   //! Parabola, BezierCurve, BSplineCurve, OtherCurve.
128     static GeomAbs_CurveType TheType (const Standard_Address C);
129   
130     static gp_Lin2d Line (const Standard_Address C);
131   
132     static gp_Circ2d Circle (const Standard_Address C);
133   
134     static gp_Elips2d Ellipse (const Standard_Address C);
135   
136     static gp_Hypr2d Hyperbola (const Standard_Address C);
137   
138     static gp_Parab2d Parabola (const Standard_Address C);
139   
140     static Handle(Geom2d_BezierCurve) Bezier (const Standard_Address C);
141   
142     static Handle(Geom2d_BSplineCurve) BSpline (const Standard_Address C);
143   
144     static Standard_Real EpsX (const Standard_Address C);
145   
146   Standard_EXPORT static Standard_Integer NbSamples (const Standard_Address C, const Standard_Real U0, const Standard_Real U1);
147   
148   Standard_EXPORT static Standard_Integer NbSamples (const Standard_Address C);
149   
150     static Standard_Integer Degree (const Standard_Address C);
151
152
153
154
155 protected:
156
157
158
159
160
161 private:
162
163
164
165
166
167 };
168
169
170 #include <HLRBRep_CurveTool.lxx>
171
172
173
174
175
176 #endif // _HLRBRep_CurveTool_HeaderFile