42cf5bc1 |
1 | // Created on: 1993-06-03 |
2 | // Created by: Jacques GOUSSARD |
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 _Contap_SurfFunction_HeaderFile |
18 | #define _Contap_SurfFunction_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <Standard_Real.hxx> |
25 | #include <Contap_TFunction.hxx> |
26 | #include <gp_Dir.hxx> |
27 | #include <gp_Pnt.hxx> |
28 | #include <gp_Dir2d.hxx> |
29 | #include <gp_Vec.hxx> |
30 | #include <Standard_Boolean.hxx> |
31 | #include <math_FunctionSetWithDerivatives.hxx> |
32 | #include <Standard_Integer.hxx> |
33 | #include <math_Vector.hxx> |
34 | class Adaptor3d_HSurface; |
35 | class StdFail_UndefinedDerivative; |
36 | class gp_Pnt; |
37 | class gp_Dir; |
38 | class math_Matrix; |
39 | class gp_Vec; |
40 | class gp_Dir2d; |
41 | |
42 | |
43 | //! This class describes the function on a parametric surface. |
44 | //! the form of the function is F(u,v) = 0 where u and v are |
45 | //! the parameteric coordinates of a point on the surface, |
46 | //! to compute the contours of the surface. |
47 | class Contap_SurfFunction : public math_FunctionSetWithDerivatives |
48 | { |
49 | public: |
50 | |
51 | DEFINE_STANDARD_ALLOC |
52 | |
53 | |
54 | Standard_EXPORT Contap_SurfFunction(); |
55 | |
56 | Standard_EXPORT void Set (const Handle(Adaptor3d_HSurface)& S); |
57 | |
58 | void Set (const gp_Pnt& Eye); |
59 | |
60 | void Set (const gp_Dir& Dir); |
61 | |
62 | void Set (const gp_Dir& Dir, const Standard_Real Angle); |
63 | |
64 | void Set (const gp_Pnt& Eye, const Standard_Real Angle); |
65 | |
66 | void Set (const Standard_Real Tolerance); |
67 | |
68 | //! This method has to return 2. |
69 | Standard_EXPORT Standard_Integer NbVariables() const; |
70 | |
71 | //! This method has to return 1. |
72 | Standard_EXPORT Standard_Integer NbEquations() const; |
73 | |
74 | //! The dimension of F is 1. |
75 | Standard_EXPORT Standard_Boolean Value (const math_Vector& X, math_Vector& F); |
76 | |
77 | //! The dimension of D is (1,2). |
78 | Standard_EXPORT Standard_Boolean Derivatives (const math_Vector& X, math_Matrix& D); |
79 | |
80 | Standard_EXPORT Standard_Boolean Values (const math_Vector& X, math_Vector& F, math_Matrix& D); |
81 | |
82 | //! Root is the value of the function at the solution. |
83 | //! It is a vector of dimension 1, i-e a real. |
84 | Standard_Real Root() const; |
85 | |
86 | //! Returns the value Tol so that if Abs(Func.Root())<Tol |
87 | //! the function is considered null. |
88 | Standard_Real Tolerance() const; |
89 | |
90 | //! Returns the value of the solution point on the surface. |
91 | const gp_Pnt& Point() const; |
92 | |
93 | Standard_EXPORT Standard_Boolean IsTangent(); |
94 | |
95 | const gp_Vec& Direction3d(); |
96 | |
97 | const gp_Dir2d& Direction2d(); |
98 | |
99 | Contap_TFunction FunctionType() const; |
100 | |
101 | const gp_Pnt& Eye() const; |
102 | |
103 | const gp_Dir& Direction() const; |
104 | |
105 | Standard_Real Angle() const; |
106 | |
107 | const Handle(Adaptor3d_HSurface)& Surface() const; |
108 | |
109 | |
110 | |
111 | |
112 | protected: |
113 | |
114 | |
115 | |
116 | |
117 | |
118 | private: |
119 | |
120 | |
121 | |
122 | Handle(Adaptor3d_HSurface) mySurf; |
123 | Standard_Real myMean; |
124 | Contap_TFunction myType; |
125 | gp_Dir myDir; |
126 | gp_Pnt myEye; |
127 | Standard_Real myAng; |
128 | Standard_Real myCosAng; |
129 | Standard_Real tol; |
130 | gp_Pnt solpt; |
131 | Standard_Real valf; |
132 | Standard_Real Usol; |
133 | Standard_Real Vsol; |
134 | Standard_Real Fpu; |
135 | Standard_Real Fpv; |
136 | gp_Dir2d d2d; |
137 | gp_Vec d3d; |
138 | Standard_Boolean tangent; |
139 | Standard_Boolean computed; |
140 | Standard_Boolean derived; |
141 | |
142 | |
143 | }; |
144 | |
145 | |
146 | #include <Contap_SurfFunction.lxx> |
147 | |
148 | |
149 | |
150 | |
151 | |
152 | #endif // _Contap_SurfFunction_HeaderFile |