1 // Created on: 2002-08-02
2 // Created by: Alexander KARTOMIN  (akm)
3 // Copyright (c) 2002-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15 
16 #ifndef _LProp3d_SLProps_HeaderFile
17 #define _LProp3d_SLProps_HeaderFile
18 
19 #include <Adaptor3d_Surface.hxx>
20 #include <LProp_Status.hxx>
21 
22 class LProp3d_SLProps
23 {
24 public:
25 
26   DEFINE_STANDARD_ALLOC
27 
28 
29   //! Initializes the local properties of the surface <S>
30   //! for the parameter values (<U>, <V>).
31   //! The current point and the derivatives are
32   //! computed at the same time, which allows an
33   //! optimization of the computation time.
34   //! <N> indicates the maximum number of derivations to
35   //! be done (0, 1, or 2). For example, to compute
36   //! only the tangent, N should be equal to 1.
37   //! <Resolution> is the linear tolerance (it is used to test
38   //! if a vector is null).
39   Standard_EXPORT LProp3d_SLProps(const Handle(Adaptor3d_Surface)& S, const Standard_Real U, const Standard_Real V, const Standard_Integer N, const Standard_Real Resolution);
40 
41   //! idem as previous constructor but without setting the value
42   //! of parameters <U> and <V>.
43   Standard_EXPORT LProp3d_SLProps(const Handle(Adaptor3d_Surface)& S, const Standard_Integer N, const Standard_Real Resolution);
44 
45   //! idem as previous constructor but without setting the value
46   //! of parameters <U> and <V> and the surface.
47   //! the surface can have an empty constructor.
48   Standard_EXPORT LProp3d_SLProps(const Standard_Integer N, const Standard_Real Resolution);
49 
50   //! Initializes the local properties of the surface S
51   //! for the new surface.
52   Standard_EXPORT void SetSurface (const Handle(Adaptor3d_Surface)& S);
53 
54   //! Initializes the local properties of the surface S
55   //! for the new parameter values (<U>, <V>).
56   Standard_EXPORT void SetParameters (const Standard_Real U, const Standard_Real V);
57 
58   //! Returns the point.
59   Standard_EXPORT const gp_Pnt& Value() const;
60 
61   //! Returns the first U derivative.
62   //! The derivative is computed if it has not been yet.
63   Standard_EXPORT const gp_Vec& D1U();
64 
65   //! Returns the first V derivative.
66   //! The derivative is computed if it has not been yet.
67   Standard_EXPORT const gp_Vec& D1V();
68 
69   //! Returns the second U derivatives
70   //! The derivative is computed if it has not been yet.
71   Standard_EXPORT const gp_Vec& D2U();
72 
73   //! Returns the second V derivative.
74   //! The derivative is computed if it has not been yet.
75   Standard_EXPORT const gp_Vec& D2V();
76 
77   //! Returns the second UV cross-derivative.
78   //! The derivative is computed if it has not been yet.
79   Standard_EXPORT const gp_Vec& DUV();
80 
81   //! returns True if the U tangent is defined.
82   //! For example, the tangent is not defined if the
83   //! two first U derivatives are null.
84   Standard_EXPORT Standard_Boolean IsTangentUDefined();
85 
86   //! Returns the tangent direction <D> on the iso-V.
87   Standard_EXPORT void TangentU (gp_Dir& D);
88 
89   //! returns if the V tangent is defined.
90   //! For example, the tangent is not defined if the
91   //! two first V derivatives are null.
92   Standard_EXPORT Standard_Boolean IsTangentVDefined();
93 
94   //! Returns the tangent direction <D> on the iso-V.
95   Standard_EXPORT void TangentV (gp_Dir& D);
96 
97   //! Tells if the normal is defined.
98   Standard_EXPORT Standard_Boolean IsNormalDefined();
99 
100   //! Returns the normal direction.
101   Standard_EXPORT const gp_Dir& Normal();
102 
103   //! returns True if the curvature is defined.
104   Standard_EXPORT Standard_Boolean IsCurvatureDefined();
105 
106   //! returns True if the point is umbilic (i.e. if the
107   //! curvature is constant).
108   Standard_EXPORT Standard_Boolean IsUmbilic();
109 
110   //! Returns the maximum curvature
111   Standard_EXPORT Standard_Real MaxCurvature();
112 
113   //! Returns the minimum curvature
114   Standard_EXPORT Standard_Real MinCurvature();
115 
116   //! Returns the direction of the maximum and minimum curvature
117   //! <MaxD> and <MinD>
118   Standard_EXPORT void CurvatureDirections (gp_Dir& MaxD, gp_Dir& MinD);
119 
120   //! Returns the mean curvature.
121   Standard_EXPORT Standard_Real MeanCurvature();
122 
123   //! Returns the Gaussian curvature
124   Standard_EXPORT Standard_Real GaussianCurvature();
125 
126 private:
127 
128   Handle(Adaptor3d_Surface) mySurf;
129   Standard_Real myU;
130   Standard_Real myV;
131   Standard_Integer myDerOrder;
132   Standard_Integer myCN;
133   Standard_Real myLinTol;
134   gp_Pnt myPnt;
135   gp_Vec myD1u;
136   gp_Vec myD1v;
137   gp_Vec myD2u;
138   gp_Vec myD2v;
139   gp_Vec myDuv;
140   gp_Dir myNormal;
141   Standard_Real myMinCurv;
142   Standard_Real myMaxCurv;
143   gp_Dir myDirMinCurv;
144   gp_Dir myDirMaxCurv;
145   Standard_Real myMeanCurv;
146   Standard_Real myGausCurv;
147   Standard_Integer mySignificantFirstDerivativeOrderU;
148   Standard_Integer mySignificantFirstDerivativeOrderV;
149   LProp_Status myUTangentStatus;
150   LProp_Status myVTangentStatus;
151   LProp_Status myNormalStatus;
152   LProp_Status myCurvatureStatus;
153 
154 };
155 
156 #endif // _LProp3d_SLProps_HeaderFile
157