0031642: Visualization - crash in Graphic3d_Structure::SetVisual() on redisplaying...
[occt.git] / src / HLRBRep / HLRBRep_CLProps.hxx
1 // Created on: 1992-10-14
2 // Created by: Christophe MARION
3 // Copyright (c) 1992-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_CLProps_HeaderFile
18 #define _HLRBRep_CLProps_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_Integer.hxx>
26 #include <gp_Pnt2d.hxx>
27 #include <gp_Vec2d.hxx>
28 #include <gp_Dir2d.hxx>
29 #include <LProp_Status.hxx>
30 #include <Standard_Boolean.hxx>
31 class LProp_BadContinuity;
32 class Standard_DomainError;
33 class Standard_OutOfRange;
34 class LProp_NotDefined;
35 class gp_Vec2d;
36 class gp_Pnt2d;
37 class gp_Dir2d;
38 class HLRBRep_CLPropsATool;
39 class HLRBRep_Curve;
40
41
42
43 class HLRBRep_CLProps 
44 {
45 public:
46
47   DEFINE_STANDARD_ALLOC
48
49   
50   //! Initializes the local properties of the curve <C>
51   //! The current point and the derivatives are
52   //! computed at the same time, which allows an
53   //! optimization of the computation time.
54   //! <N> indicates the maximum number of derivations to
55   //! be done (0, 1, 2 or 3). For example, to compute
56   //! only the tangent, N should be equal to 1.
57   //! <Resolution> is the linear tolerance (it is used to test
58   //! if a vector is null).
59   Standard_EXPORT HLRBRep_CLProps(const HLRBRep_Curve*& C, const Standard_Integer N, const Standard_Real Resolution);
60   
61   //! Same as previous constructor but here the parameter is
62   //! set to the value <U>.
63   //! All the computations done will be related to <C> and <U>.
64   Standard_EXPORT HLRBRep_CLProps(const HLRBRep_Curve*& C, const Standard_Real U, const Standard_Integer N, const Standard_Real Resolution);
65   
66   //! Same as previous constructor but here the parameter is
67   //! set to the value <U> and the curve is set
68   //! with SetCurve.
69   //! the curve can have a empty constructor
70   //! All the computations done will be related to <C> and <U>
71   //! when the functions "set" will be done.
72   Standard_EXPORT HLRBRep_CLProps(const Standard_Integer N, const Standard_Real Resolution);
73   
74   //! Initializes the local properties of the curve
75   //! for the parameter value <U>.
76   Standard_EXPORT void SetParameter (const Standard_Real U);
77   
78   //! Initializes the local properties of the curve
79   //! for the new curve.
80   Standard_EXPORT void SetCurve (const HLRBRep_Curve*& C);
81   
82   //! Returns the Point.
83   Standard_EXPORT const gp_Pnt2d& Value() const;
84   
85   //! Returns the first derivative.
86   //! The derivative is computed if it has not been yet.
87   Standard_EXPORT const gp_Vec2d& D1();
88   
89   //! Returns the second derivative.
90   //! The derivative is computed if it has not been yet.
91   Standard_EXPORT const gp_Vec2d& D2();
92   
93   //! Returns the third derivative.
94   //! The derivative is computed if it has not been yet.
95   Standard_EXPORT const gp_Vec2d& D3();
96   
97   //! Returns True if the tangent is defined.
98   //! For example, the tangent is not defined if the
99   //! three first derivatives are all null.
100   Standard_EXPORT Standard_Boolean IsTangentDefined();
101   
102   //! output  the tangent direction <D>
103   Standard_EXPORT void Tangent (gp_Dir2d& D);
104   
105   //! Returns the curvature.
106   Standard_EXPORT Standard_Real Curvature();
107   
108   //! Returns the normal direction <N>.
109   Standard_EXPORT void Normal (gp_Dir2d& N);
110   
111   //! Returns the centre of curvature <P>.
112   Standard_EXPORT void CentreOfCurvature (gp_Pnt2d& P);
113
114
115
116
117 protected:
118
119
120
121
122
123 private:
124
125
126
127   const HLRBRep_Curve* myCurve;
128   Standard_Real myU;
129   Standard_Integer myDerOrder;
130   Standard_Real myCN;
131   Standard_Real myLinTol;
132   gp_Pnt2d myPnt;
133   gp_Vec2d myDerivArr[3];
134   gp_Dir2d myTangent;
135   Standard_Real myCurvature;
136   LProp_Status myTangentStatus;
137   Standard_Integer mySignificantFirstDerivativeOrder;
138
139
140 };
141
142
143
144
145
146
147
148 #endif // _HLRBRep_CLProps_HeaderFile