1 -- Created on: 1995-11-02
2 -- Created by: Jacques GOUSSARD
3 -- Copyright (c) 1995-1999 Matra Datavision
4 -- Copyright (c) 1999-2012 OPEN CASCADE SAS
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
8 -- except in compliance with the License. Please obtain a copy of the License
9 -- at http://www.opencascade.org and read it completely before using this file.
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.
14 -- The Original Code and all software distributed under the License is
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.
23 class QuasiUniformDeflection from GCPnts
25 ---Purpose: This class computes a distribution of points on a
26 -- curve. The points may respect the deflection. The algorithm
27 -- is not based on the classical prediction (with second
28 -- derivative of curve), but either on the evaluation of
29 -- the distance between the mid point and the point of
30 -- mid parameter of the two points, or the distance
31 -- between the mid point and the point at parameter 0.5
32 -- on the cubic interpolation of the two points and their
34 -- Note: this algorithm is faster than a
35 -- GCPnts_UniformDeflection algorithm, and is
36 -- able to work with non-"C2" continuous curves.
37 -- However, it generates more points in the distribution.
42 Curve2d from Adaptor2d,
44 SequenceOfPnt from TColgp,
45 SequenceOfReal from TColStd
48 raises DomainError from Standard,
49 ConstructionError from Standard,
50 OutOfRange from Standard,
56 ---Purpose: Constructs an empty algorithm. To define the problem
57 -- to be solved, use the function Initialize.
58 returns QuasiUniformDeflection from GCPnts;
60 Create(C : in out Curve from Adaptor3d; Deflection : Real;
61 Continuity: Shape from GeomAbs = GeomAbs_C1)
62 --- Purpose : Computes a QuasiUniform Deflection distribution
63 -- of points on the Curve <C>.
64 returns QuasiUniformDeflection from GCPnts
65 raises ConstructionError;
67 Create(C : in out Curve2d from Adaptor2d; Deflection : Real;
68 Continuity: Shape from GeomAbs = GeomAbs_C1)
69 --- Purpose : Computes a QuasiUniform Deflection distribution
70 -- of points on the Curve <C>.
71 returns QuasiUniformDeflection from GCPnts
72 raises ConstructionError;
74 Create(C : in out Curve from Adaptor3d; Deflection, U1, U2 : Real;
75 Continuity: Shape from GeomAbs = GeomAbs_C1)
76 --- Purpose : Computes a QuasiUniform Deflection distribution
77 -- of points on a part of the Curve <C>.
78 returns QuasiUniformDeflection from GCPnts
79 raises ConstructionError,
82 Create(C : in out Curve2d from Adaptor2d; Deflection, U1, U2 : Real;
83 Continuity: Shape from GeomAbs = GeomAbs_C1)
84 ---Purpose : Computes a QuasiUniform Deflection distribution
85 -- of points on a part of the Curve <C>.
86 -- This and the above algorithms compute a distribution of points:
87 -- - on the curve C, or
88 -- - on the part of curve C limited by the two
89 -- parameter values U1 and U2,
90 -- where the deflection resulting from the distributed
91 -- points is not greater than Deflection.
92 -- The first point of the distribution is either the origin of
93 -- curve C or the point of parameter U1. The last point
94 -- of the distribution is either the end point of curve C or
95 -- the point of parameter U2.
96 -- Intermediate points of the distribution are built such
97 -- that the deflection is not greater than Deflection.
98 -- Using the following evaluation of the deflection:
99 -- if Pi and Pj are two consecutive points of the
100 -- distribution, respectively of parameter ui and uj on
101 -- the curve, the deflection is the distance between:
102 -- - the mid-point of Pi and Pj (the center of the
103 -- chord joining these two points)
104 -- - and the point of mid-parameter of these two
105 -- points (the point of parameter [(ui+uj) / 2 ] on curve C).
106 -- Continuity, defaulted to GeomAbs_C1, gives the
107 -- degree of continuity of the curve C. (Note that C is an
108 -- Adaptor3d_Curve or an Adaptor2d_Curve2d
109 -- object, and does not know the degree of continuity of
110 -- the underlying curve).
111 -- Use the function IsDone to verify that the
112 -- computation was successful, the function NbPoints
113 -- to obtain the number of points of the computed
114 -- distribution, and the function Parameter to read the
115 -- parameter of each point.
117 -- - The roles of U1 and U2 are inverted if U1 > U2.
118 -- - Derivative functions on the curve are called
119 -- according to Continuity. An error may occur if
120 -- Continuity is greater than the real degree of
121 -- continuity of the curve.
123 -- C is an adapted curve, i.e. an object which is an
124 -- interface between:
125 -- - the services provided by either a 2D curve from
126 -- the package Geom2d (in the case of an
127 -- Adaptor2d_Curve2d curve) or a 3D curve from
128 -- the package Geom (in the case of an
129 -- Adaptor3d_Curve curve),
130 -- - and those required on the curve by the
131 -- computation algorithm.
132 returns QuasiUniformDeflection from GCPnts
133 raises ConstructionError,
136 Initialize(me : in out; C : in out Curve from Adaptor3d; Deflection : Real;
137 Continuity: Shape from GeomAbs = GeomAbs_C1)
138 ---Purpose: Initialize the algoritms with <C>, <Deflection>
139 raises ConstructionError
142 Initialize(me : in out; C : in out Curve2d from Adaptor2d; Deflection : Real;
143 Continuity: Shape from GeomAbs = GeomAbs_C1)
144 ---Purpose: Initialize the algoritms with <C>, <Deflection>
145 raises ConstructionError
148 Initialize(me : in out; C : in out Curve from Adaptor3d; Deflection, U1, U2 : Real;
149 Continuity: Shape from GeomAbs = GeomAbs_C1)
150 ---Purpose: Initialize the algoritms with <C>, <Deflection>,
152 raises ConstructionError,
156 Initialize(me : in out; C : in out Curve2d from Adaptor2d;
157 Deflection, U1, U2 : Real;
158 Continuity: Shape from GeomAbs = GeomAbs_C1)
159 ---Purpose: Initialize the algoritms with <C>, <Deflection>,
161 -- This and the above algorithms initialize (or reinitialize)
162 -- this algorithm and compute a distribution of points:
163 -- - on the curve C, or
164 -- - on the part of curve C limited by the two
165 -- parameter values U1 and U2,
166 -- where the deflection resulting from the distributed
167 -- points is not greater than Deflection.
168 -- The first point of the distribution is either the origin
169 -- of curve C or the point of parameter U1. The last
170 -- point of the distribution is either the end point of
171 -- curve C or the point of parameter U2.
172 -- Intermediate points of the distribution are built in
173 -- such a way that the deflection is not greater than
174 -- Deflection. Using the following evaluation of the deflection:
175 -- if Pi and Pj are two consecutive points of the
176 -- distribution, respectively of parameter ui and uj
177 -- on the curve, the deflection is the distance between:
178 -- - the mid-point of Pi and Pj (the center of the
179 -- chord joining these two points)
180 -- - and the point of mid-parameter of these two
181 -- points (the point of parameter [(ui+uj) / 2 ] on curve C).
182 -- Continuity, defaulted to GeomAbs_C1, gives the
183 -- degree of continuity of the curve C. (Note that C is
184 -- an Adaptor3d_Curve or an
185 -- Adaptor2d_Curve2d object, and does not know
186 -- the degree of continuity of the underlying curve).
187 -- Use the function IsDone to verify that the
188 -- computation was successful, the function NbPoints
189 -- to obtain the number of points of the computed
190 -- distribution, and the function Parameter to read
191 -- the parameter of each point.
193 -- - The roles of U1 and U2 are inverted if U1 > U2.
194 -- - Derivative functions on the curve are called
195 -- according to Continuity. An error may occur if
196 -- Continuity is greater than the real degree of
197 -- continuity of the curve.
199 -- C is an adapted curve, i.e. an object which is an
200 -- interface between:
201 -- - the services provided by either a 2D curve from
202 -- the package Geom2d (in the case of an
203 -- Adaptor2d_Curve2d curve) or a 3D curve from
204 -- the package Geom (in the case of an Adaptor3d_Curve curve),
205 -- and those required on the curve by the computation algorithm.
206 raises ConstructionError,
210 IsDone(me) returns Boolean
213 -- Returns true if the computation was successful.
214 -- IsDone is a protection against:
215 -- - non-convergence of the algorithm
216 -- - querying the results before computation.
219 NbPoints(me) returns Integer
222 -- Returns the number of points of the distribution
223 -- computed by this algorithm.
225 -- StdFail_NotDone if this algorithm has not been
226 -- initialized, or if the computation was not successful.
229 Parameter(me; Index : Integer) returns Real
231 --- Purpose : Returns the parameter of the point of index Index in
232 -- the distribution computed by this algorithm.
234 -- Index must be greater than or equal to 1, and less
235 -- than or equal to the number of points of the
236 -- distribution. However, pay particular attention as this
237 -- condition is not checked by this function.
239 -- StdFail_NotDone if this algorithm has not been
240 -- initialized, or if the computation was not successful.
243 Value(me; Index : Integer) returns Pnt from gp
244 --- Purpose : Returns the point of index Index in the distribution
245 -- computed by this algorithm.
247 -- Index must be greater than or equal to 1, and less
248 -- than or equal to the number of points of the
249 -- distribution. However, pay particular attention as this
250 -- condition is not checked by this function.
252 -- StdFail_NotDone if this algorithm has not been
253 -- initialized, or if the computation was not successful.
256 Deflection(me) returns Real
258 --- Purpose : Returns the deflection between the curve and the
259 -- polygon resulting from the points of the distribution
260 -- computed by this algorithm.
261 -- This is the value given to the algorithm at the time
262 -- of construction (or initialization).
264 -- StdFail_NotDone if this algorithm has not been
265 -- initialized, or if the computation was not successful.
272 myParams : SequenceOfReal from TColStd;
273 myPoints : SequenceOfPnt from TColgp;
274 myCont : Shape from GeomAbs;
276 end QuasiUniformDeflection;