42cf5bc1 |
1 | // Created on: 1991-07-15 |
2 | // Created by: Isabelle GRIGNON |
3 | // Copyright (c) 1991-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 _CPnts_AbscissaPoint_HeaderFile |
18 | #define _CPnts_AbscissaPoint_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <Standard_Boolean.hxx> |
25 | #include <Standard_Real.hxx> |
26 | #include <CPnts_MyRootFunction.hxx> |
27 | class StdFail_NotDone; |
28 | class Standard_ConstructionError; |
29 | class Adaptor3d_Curve; |
30 | class Adaptor2d_Curve2d; |
31 | |
32 | |
33 | //! the algorithm computes a point on a curve at a given |
34 | //! distance from another point on the curve |
35 | //! |
36 | //! We can instantiates with |
37 | //! Curve from Adaptor3d, Pnt from gp, Vec from gp |
38 | //! |
39 | //! or |
40 | //! Curve2d from Adaptor2d, Pnt2d from gp, Vec2d from gp |
41 | class CPnts_AbscissaPoint |
42 | { |
43 | public: |
44 | |
45 | DEFINE_STANDARD_ALLOC |
46 | |
47 | |
48 | //! Computes the length of the Curve <C>. |
49 | Standard_EXPORT static Standard_Real Length (const Adaptor3d_Curve& C); |
50 | |
51 | //! Computes the length of the Curve <C>. |
52 | Standard_EXPORT static Standard_Real Length (const Adaptor2d_Curve2d& C); |
53 | |
54 | //! Computes the length of the Curve <C> with the given tolerance. |
55 | Standard_EXPORT static Standard_Real Length (const Adaptor3d_Curve& C, const Standard_Real Tol); |
56 | |
57 | //! Computes the length of the Curve <C> with the given tolerance. |
58 | Standard_EXPORT static Standard_Real Length (const Adaptor2d_Curve2d& C, const Standard_Real Tol); |
59 | |
60 | //! Computes the length of the Curve <C> between <U1> and <U2>. |
61 | Standard_EXPORT static Standard_Real Length (const Adaptor3d_Curve& C, const Standard_Real U1, const Standard_Real U2); |
62 | |
63 | //! Computes the length of the Curve <C> between <U1> and <U2>. |
64 | Standard_EXPORT static Standard_Real Length (const Adaptor2d_Curve2d& C, const Standard_Real U1, const Standard_Real U2); |
65 | |
66 | //! Computes the length of the Curve <C> between <U1> and <U2> with the given tolerance. |
67 | Standard_EXPORT static Standard_Real Length (const Adaptor3d_Curve& C, const Standard_Real U1, const Standard_Real U2, const Standard_Real Tol); |
68 | |
69 | //! Computes the length of the Curve <C> between <U1> and <U2> with the given tolerance. |
70 | //! creation of a indefinite AbscissaPoint. |
71 | Standard_EXPORT static Standard_Real Length (const Adaptor2d_Curve2d& C, const Standard_Real U1, const Standard_Real U2, const Standard_Real Tol); |
72 | |
73 | Standard_EXPORT CPnts_AbscissaPoint(); |
74 | |
75 | //! the algorithm computes a point on a curve <Curve> at the |
76 | //! distance <Abscissa> from the point of parameter <U0>. |
77 | //! <Resolution> is the error allowed in the computation. |
78 | //! The computed point can be outside of the curve 's bounds. |
79 | Standard_EXPORT CPnts_AbscissaPoint(const Adaptor3d_Curve& C, const Standard_Real Abscissa, const Standard_Real U0, const Standard_Real Resolution); |
80 | |
81 | //! the algorithm computes a point on a curve <Curve> at the |
82 | //! distance <Abscissa> from the point of parameter <U0>. |
83 | //! <Resolution> is the error allowed in the computation. |
84 | //! The computed point can be outside of the curve 's bounds. |
85 | Standard_EXPORT CPnts_AbscissaPoint(const Adaptor2d_Curve2d& C, const Standard_Real Abscissa, const Standard_Real U0, const Standard_Real Resolution); |
86 | |
87 | //! the algorithm computes a point on a curve <Curve> at the |
88 | //! distance <Abscissa> from the point of parameter <U0>. |
89 | //! <Ui> is the starting value used in the iterative process |
90 | //! which find the solution, it must be closed to the final |
91 | //! solution |
92 | //! <Resolution> is the error allowed in the computation. |
93 | //! The computed point can be outside of the curve 's bounds. |
94 | Standard_EXPORT CPnts_AbscissaPoint(const Adaptor3d_Curve& C, const Standard_Real Abscissa, const Standard_Real U0, const Standard_Real Ui, const Standard_Real Resolution); |
95 | |
96 | //! the algorithm computes a point on a curve <Curve> at the |
97 | //! distance <Abscissa> from the point of parameter <U0>. |
98 | //! <Ui> is the starting value used in the iterative process |
99 | //! which find the solution, it must be closed to the final |
100 | //! solution |
101 | //! <Resolution> is the error allowed in the computation. |
102 | //! The computed point can be outside of the curve 's bounds. |
103 | Standard_EXPORT CPnts_AbscissaPoint(const Adaptor2d_Curve2d& C, const Standard_Real Abscissa, const Standard_Real U0, const Standard_Real Ui, const Standard_Real Resolution); |
104 | |
105 | //! Initializes the resolution function with <C>. |
106 | Standard_EXPORT void Init (const Adaptor3d_Curve& C); |
107 | |
108 | //! Initializes the resolution function with <C>. |
109 | Standard_EXPORT void Init (const Adaptor2d_Curve2d& C); |
110 | |
111 | //! Initializes the resolution function with <C>. |
112 | Standard_EXPORT void Init (const Adaptor3d_Curve& C, const Standard_Real Tol); |
113 | |
114 | //! Initializes the resolution function with <C>. |
115 | Standard_EXPORT void Init (const Adaptor2d_Curve2d& C, const Standard_Real Tol); |
116 | |
117 | //! Initializes the resolution function with <C> |
118 | //! between U1 and U2. |
119 | Standard_EXPORT void Init (const Adaptor3d_Curve& C, const Standard_Real U1, const Standard_Real U2); |
120 | |
121 | //! Initializes the resolution function with <C> |
122 | //! between U1 and U2. |
123 | Standard_EXPORT void Init (const Adaptor2d_Curve2d& C, const Standard_Real U1, const Standard_Real U2); |
124 | |
125 | //! Initializes the resolution function with <C> |
126 | //! between U1 and U2. |
127 | Standard_EXPORT void Init (const Adaptor3d_Curve& C, const Standard_Real U1, const Standard_Real U2, const Standard_Real Tol); |
128 | |
129 | //! Initializes the resolution function with <C> |
130 | //! between U1 and U2. |
131 | Standard_EXPORT void Init (const Adaptor2d_Curve2d& C, const Standard_Real U1, const Standard_Real U2, const Standard_Real Tol); |
132 | |
133 | //! Computes the point at the distance <Abscissa> of |
134 | //! the curve. |
135 | Standard_EXPORT void Perform (const Standard_Real Abscissa, const Standard_Real U0, const Standard_Real Resolution); |
136 | |
137 | //! Computes the point at the distance <Abscissa> of |
138 | //! the curve. |
139 | Standard_EXPORT void Perform (const Standard_Real Abscissa, const Standard_Real U0, const Standard_Real Ui, const Standard_Real Resolution); |
140 | |
141 | //! Computes the point at the distance <Abscissa> of |
142 | //! the curve; performs more appropriate tolerance managment; |
143 | //! to use this method in right way it is necessary to call |
144 | //! empty consructor. then call method Init with |
145 | //! Tolerance = Resolution, then call AdvPermorm. |
146 | Standard_EXPORT void AdvPerform (const Standard_Real Abscissa, const Standard_Real U0, const Standard_Real Ui, const Standard_Real Resolution); |
147 | |
148 | //! True if the computation was successful, False otherwise. |
149 | Standard_Boolean IsDone() const; |
150 | |
151 | //! Returns the parameter of the solution. |
152 | Standard_Real Parameter() const; |
153 | |
154 | //! Enforce the solution, used by GCPnts. |
155 | void SetParameter (const Standard_Real P); |
156 | |
157 | |
158 | |
159 | |
160 | protected: |
161 | |
162 | |
163 | |
164 | |
165 | |
166 | private: |
167 | |
168 | |
169 | |
170 | Standard_Boolean myDone; |
171 | Standard_Real myL; |
172 | Standard_Real myParam; |
173 | Standard_Real myUMin; |
174 | Standard_Real myUMax; |
175 | CPnts_MyRootFunction myF; |
176 | |
177 | |
178 | }; |
179 | |
180 | |
181 | #include <CPnts_AbscissaPoint.lxx> |
182 | |
183 | |
184 | |
185 | |
186 | |
187 | #endif // _CPnts_AbscissaPoint_HeaderFile |