CommitLineData
b311480e 1-- Created on: 1992-03-23
2-- Created by: Herve LEGRAND
3-- Copyright (c) 1992-1999 Matra Datavision
5--
6-- The content of this file is subject to the Open CASCADE Technology Public
7-- License Version 6.5 (the "License"). You may not use the content of this file
10--
11-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13--
15-- distributed on an "AS IS" basis, without warranty of any kind, and the
16-- Initial Developer hereby disclaims all such warranties, including without
17-- limitation, any warranties of merchantability, fitness for a particular
18-- purpose or non-infringement. Please see the License for the specific terms
19-- and conditions governing the rights and limitations under the License.
20
7fd59977 21
22class UniformDeflection from GCPnts
23
24 ---Purpose: Provides an algorithm to compute a distribution of
25 -- points on a 'C2' continuous curve. The algorithm
26 -- respects a criterion of maximum deflection between
27 -- the curve and the polygon that results from the computed points.
28 -- Note: This algorithm is relatively time consuming. A
29 -- GCPnts_QuasiUniformDeflection algorithm is
30 -- quicker; it can also work with non-'C2' continuous
31 -- curves, but it generates more points in the distribution.
32
33uses
34 Pnt from gp,
37 SequenceOfPnt from TColgp,
38 SequenceOfReal from TColStd
39
40
41raises DomainError from Standard,
42 ConstructionError from Standard,
43 OutOfRange from Standard,
44 NotDone from StdFail
45
46is
47
48 Create
49 ---Purpose: Constructs an empty algorithm. To define the problem
50 -- to be solved, use the function Initialize.
51 returns UniformDeflection from GCPnts;
52
53 Create(C : in out Curve from Adaptor3d; Deflection : Real;
54 WithControl : Boolean = Standard_True)
55 --- Purpose : Computes a uniform Deflection distribution of points on
56 -- the Curve <C>.
57 -- if <WithControl> is True,the algorithm controls the estimate
58 -- deflection
59 returns UniformDeflection from GCPnts
60 raises ConstructionError;
61
62 Create(C : in out Curve2d from Adaptor2d; Deflection : Real;
63 WithControl : Boolean = Standard_True)
64 --- Purpose : Computes a uniform Deflection distribution of points on
65 -- the Curve <C>.
66 -- if <WithControl> is True,the algorithm controls the estimate
67 -- deflection
68 returns UniformDeflection from GCPnts
69 raises ConstructionError;
70
71 Create(C : in out Curve from Adaptor3d; Deflection, U1, U2 : Real;
72 WithControl : Boolean = Standard_True)
73 --- Purpose : Computes a Uniform Deflection distribution of points
74 -- on a part of the Curve <C>.
75 -- if <WithControl> is True,the algorithm controls the estimate
76 -- deflection
77 returns UniformDeflection from GCPnts
78 raises ConstructionError,
79 DomainError;
80
81 Create(C : in out Curve2d from Adaptor2d; Deflection, U1, U2 : Real;
82 WithControl : Boolean = Standard_True)
83 --- Purpose : Computes a Uniform Deflection distribution of points
84 -- on a part of the Curve <C>.
85 -- if <WithControl> is True,the algorithm controls the estimate
86 -- deflection
87 --This and the above algorithms compute a distribution of points:
88 -- - on the curve C, or
89 -- - on the part of curve C limited by the two
90 -- parameter values U1 and U2,
91 -- where the maximum distance between C and the
92 -- polygon that results from the points of the distribution
93 -- is not greater than Deflection.
94 -- The first point of the distribution is either the origin of
95 -- curve C or the point of parameter U1. The last point
96 -- of the distribution is either the end point of curve C or
97 -- the point of parameter U2. Intermediate points of the
98 -- distribution are built using interpolations of segments
99 -- of the curve limited at the 2nd degree. Primarily, the
100 -- construction algorithm ensures that the chordal
101 -- deviation for this interpolation of the curve is less
102 -- than or equal to Deflection. However, it does not
103 -- ensure that the chordal deviation for the curve itself is
104 -- less than or equal to Deflection. To do this a check is
105 -- necessary, which may generate (second step)
106 -- additional intermediate points. This check is time
107 -- consuming and can be avoided by setting
108 -- WithControl to false. Note that by default
109 -- WithControl is true and the check is performed.
110 -- Use the function IsDone to verify that the
111 -- computation was successful, the function NbPoints
112 -- to obtain the number of points of the computed
113 -- distribution, and the function Parameter to read the
114 -- parameter of each point.
115 -- Warning
116 -- - C is necessary, 'C2' continuous. This property is
117 -- not checked at construction time.
118 -- - The roles of U1 and U2 are inverted if U1 > U2.
119 -- Warning
120 -- C is an adapted curve, i.e. an object which is an interface between:
121 -- - the services provided by either a 2D curve from
122 -- the package Geom2d (in the case of an
123 -- Adaptor2d_Curve2d curve) or a 3D curve from
124 -- the package Geom (in the case of an
126 -- - and those required on the curve by the computation algorithm.
127 returns UniformDeflection from GCPnts
128 raises ConstructionError,
129 DomainError;
130
131 Initialize(me : in out; C : in out Curve from Adaptor3d; Deflection : Real;
132 WithControl : Boolean = Standard_True)
133 ---Purpose: Initialize the algoritms with <C>, <Deflection>
134 raises ConstructionError
135 is static;
136
137 Initialize(me : in out; C : in out Curve2d from Adaptor2d; Deflection : Real;
138 WithControl : Boolean = Standard_True)
139 ---Purpose: Initialize the algoritms with <C>, <Deflection>
140 raises ConstructionError
141 is static;
142
143 Initialize(me : in out; C : in out Curve from Adaptor3d; Deflection, U1, U2 : Real;
144 WithControl : Boolean = Standard_True)
145 ---Purpose: Initialize the algoritms with <C>, <Deflection>,
146 -- <U1>,<U2>
147 raises ConstructionError,
148 DomainError
149 is static;
150
151 Initialize(me : in out; C : in out Curve2d from Adaptor2d;
152 Deflection, U1, U2 : Real;
153 WithControl : Boolean = Standard_True)
154 ---Purpose: Initialize the algoritms with <C>, <Deflection>,
155 -- <U1>,<U2>
156 -- This and the above methods initialize (or reinitialize) this algorithm and
157 -- compute a distribution of points:
158 -- - on the curve C, or
159 -- - on the part of curve C limited by the two
160 -- parameter values U1 and U2,
161 -- where the maximum distance between C and the
162 -- polygon that results from the points of the
163 -- distribution is not greater than Deflection.
164 -- The first point of the distribution is either the origin
165 -- of curve C or the point of parameter U1. The last
166 -- point of the distribution is either the end point of
167 -- curve C or the point of parameter U2. Intermediate
168 -- points of the distribution are built using
169 -- interpolations of segments of the curve limited at
170 -- the 2nd degree. The construction ensures, in a first
171 -- step, that the chordal deviation for this
172 -- interpolation of the curve is less than or equal to
173 -- Deflection. However, it does not ensure that the
174 -- chordal deviation for the curve itself is less than or
175 -- equal to Deflection. To do this a check is
176 -- necessary, which may generate (second step)
177 -- additional intermediate points. This check is time
178 -- consuming, and can be avoided by setting
179 -- WithControl to false. Note that by default
180 -- WithControl is true and check is performed.
181 -- Use the function IsDone to verify that the
182 -- computation was successful, the function NbPoints
183 -- to obtain the number of points of the computed
184 -- distribution, and the function Parameter to read
185 -- the parameter of each point.
186 -- Warning
187 -- - C is necessary, 'C2' continuous. This property is
188 -- not checked at construction time.
189 -- - The roles of U1 and U2 are inverted if U1 > U2.
190 -- Warning
191 -- C is an adapted curve, i.e. an object which is an interface between:
192 -- - the services provided by either a 2D curve from
193 -- the package Geom2d (in the case of an
194 -- Adaptor2d_Curve2d curve) or a 3D curve from
195 -- the package Geom (in the case of an Adaptor3d_Curve curve),
196 -- - and those required on the curve by the computation algorithm.
197 raises ConstructionError,
198 DomainError
199 is static;
200
201
202 IsDone(me) returns Boolean
203 ---C++: inline
204 ---Purpose: Returns true if the computation was successful.
205 -- IsDone is a protection against:
206 -- - non-convergence of the algorithm
207 -- - querying the results before computation.
208 is static;
209
210 NbPoints(me) returns Integer
211 ---C++: inline
212 ---Purpose: Returns the number of points of the distribution
213 -- computed by this algorithm.
214 -- Exceptions
215 -- StdFail_NotDone if this algorithm has not been
216 -- initialized, or if the computation was not successful.
217 is static;
218
219 Parameter(me; Index : Integer) returns Real
220 ---C++: inline
221 --- Purpose : Returns the parameter of the point of index Index in
222 -- the distribution computed by this algorithm.
223 -- Warning
224 -- Index must be greater than or equal to 1, and less
225 -- than or equal to the number of points of the
226 -- distribution. However, pay particular attention as this
227 -- condition is not checked by this function.
228 -- Exceptions
229 -- StdFail_NotDone if this algorithm has not been
230 -- initialized, or if the computation was not successful.
231 is static;
232
233 Value(me; Index : Integer) returns Pnt from gp
234 --- Purpose : Returns the point of index Index in the distribution
235 -- computed by this algorithm.
236 -- Warning
237 -- Index must be greater than or equal to 1, and less
238 -- than or equal to the number of points of the
239 -- distribution. However, pay particular attention as this
240 -- condition is not checked by this function.
241 -- Exceptions
242 -- StdFAil_NotDone if this algorithm has not been
243 -- initialized, or if the computation was not successful.
244 is static;
245
246 Deflection(me) returns Real
247 ---C++: inline
248 --- Purpose : Returns the deflection between the curve and the
249 -- polygon resulting from the points of the distribution
250 -- computed by this algorithm.
251 -- This value is the one given to the algorithm at the
252 -- time of construction (or initialization).
253 -- Exceptions
254 -- StdFail_NotDone if this algorithm has not been
255 -- initialized, or if the computation was not successful.
256 is static;
257
258fields
259
260 myDone : Boolean;
261 myDeflection : Real;
262 myParams : SequenceOfReal from TColStd;
263 myPoints : SequenceOfPnt from TColgp;
264
265end UniformDeflection;
266