b311480e |
1 | -- Created on: 1992-10-08 |
2 | -- Created by: Isabelle GRIGNON |
3 | -- Copyright (c) 1992-1999 Matra Datavision |
4 | -- Copyright (c) 1999-2012 OPEN CASCADE SAS |
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 |
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. |
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 | -- |
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. |
20 | |
7fd59977 |
21 | |
22 | |
23 | |
24 | |
25 | package Adaptor3d |
26 | |
27 | ---Purpose: The Adaptor3d package is used to help defining |
28 | -- reusable geometric algorithms. i.e. that can be |
29 | -- used on curves and surfaces. |
30 | -- |
31 | -- It defines general services for 3 kind of objects : |
32 | -- |
33 | -- - the 2d curve. Curve2d |
34 | -- - the 3d curve. Curve |
35 | -- - the 3d surface. Surface |
36 | -- |
37 | -- The services are : |
38 | -- |
39 | -- - Usual services found in Geom or Geom2d : |
40 | -- |
41 | -- * parameter range, value and derivatives, etc... |
42 | -- |
43 | -- - Continuity breakout services : |
44 | -- |
45 | -- * Allows to divide a curve or a surfaces in |
46 | -- parts with a given derivation order. |
47 | -- |
48 | -- - Special geometries detection services : |
49 | -- |
50 | -- * Allows to test for special cases that can |
51 | -- be processed more easily : |
52 | -- - Conics, Quadrics, Bezier, BSpline ... |
53 | -- |
54 | -- And to get the correponding data form the |
55 | -- package gp or Geom. The special type |
56 | -- OtherCurve means that no special case has |
57 | -- been detected and the algorithm may use |
58 | -- only the evaluation methods (D0, D1, ...) |
59 | -- |
60 | -- |
61 | -- For each category Curve2d, Curve, Surface we |
62 | -- define three classes, we illustrate now the |
63 | -- principles with the Curve, the same applies to |
64 | -- Curve2d and Surface. |
65 | -- |
66 | -- The class Curve is the abstract root for all |
67 | -- Curves used by algorithms, it is handled by value |
68 | -- and provides as deferred methods the services |
69 | -- described above. |
70 | -- |
71 | -- Some services (breakout) requires to create new |
72 | -- curves, this leads to memory allocation |
73 | -- considerations (who create the curve, who deletes |
74 | -- it ?). To solve this problem elegantly the curve |
75 | -- will return a HCurve, the HCurve is a curve |
76 | -- handled by reference so it will be deallocated |
77 | -- automatically when it is not used. |
78 | -- |
79 | -- A third class GenHCurve is provided, this class is |
80 | -- generic and its utility is to provide automatic |
81 | -- generation of the HCurve class when you have |
82 | -- written the Curve class. |
83 | -- |
84 | -- |
85 | -- * Let us show an example (with 2d curves) : |
86 | -- |
87 | -- Imagine an algorithm to intersect curves, this |
88 | -- algorithms is written to process Curve2d from |
89 | -- Adaptor3d : |
90 | -- |
91 | -- A method may look like : |
92 | -- |
93 | -- Intersect(C1,C2 : Curve2d from Adaptor3d); |
94 | -- |
95 | -- Which will look like in C++ |
96 | -- |
97 | -- Intersect(const Adaptor2d_Curve2d& C1, |
98 | -- const Adaptor2d_Curve2d& C2) |
99 | -- { |
100 | -- // you can call any method |
101 | -- Standard_Real first1 = C1.FirstParameter(); |
102 | -- |
103 | -- // but avoid to copy in an Adaptor3d_Curve which |
104 | -- // is an Abstract class, use a reference or a pointer |
105 | -- |
106 | -- const Adaptor3d_Curve& C = C1; |
107 | -- const Adaptor3d_Curve *pC = &C1; |
108 | -- |
109 | -- // If you are interseted in Intervals you must |
110 | -- // store them in a HCurve to ensure they are kept |
111 | -- // in memory. Then a referrence may be used. |
112 | -- |
113 | -- Handle(Adaptor3d_HCurve) HCI = C1.Interval(1); |
114 | -- |
115 | -- const Adaptor3d_Curve& CI = HCI->Curve(); |
116 | -- pC = &(HCI->Curve()); |
117 | -- |
118 | -- |
119 | -- * The Adaptor3d provides also Generic classes |
120 | -- implementing algorithmic curves and surfaces. |
121 | -- |
122 | -- - IsoCurve : Isoparametric curve on a surface. |
123 | -- - CurveOnSurface : 2D curve in the parametric |
124 | -- space of a surface. |
125 | -- |
126 | -- |
127 | -- - OffsetCurve2d : 2d offset curve |
128 | -- - ProjectedCurve : 3d curve projected on a plane |
129 | -- - SurfaceOfLinearExtrusion |
130 | -- - SurfaceOfRevolution |
131 | -- |
132 | -- They are instantiated with HCurve, HSurface, HCurved2d |
133 | |
134 | uses |
135 | Standard, |
136 | MMgt, |
137 | TColStd, |
138 | GeomAbs, |
139 | TopAbs, |
140 | TColgp, |
141 | gp, |
142 | Geom2d, |
143 | Geom, |
144 | math, |
145 | Adaptor2d |
146 | |
147 | is |
148 | |
149 | deferred class Curve; |
150 | ---Purpose: Root of the 3d curve. |
151 | |
152 | pointer CurvePtr to Curve from Adaptor3d; |
153 | |
154 | deferred class HCurve; |
155 | ---Purpose: deferred class for the curves manipulated with |
156 | -- Handle. |
157 | |
158 | generic class GenHCurve; |
159 | ---Purpose: Generic class used to create a curve inheriting |
160 | -- from HCurve. |
161 | |
162 | |
163 | deferred class Surface; |
164 | ---Purpose: Root of the surface. |
165 | |
166 | pointer SurfacePtr to Surface from Adaptor3d; |
167 | |
168 | deferred class HSurface; |
169 | ---Purpose: deferred class for the surfaces manipulated with |
170 | -- Handle. |
171 | |
172 | generic class GenHSurface; |
173 | ---Purpose: Generic class used to create a surface inheriting |
174 | -- from HSurface. |
175 | |
176 | |
177 | -- |
178 | -- The following classes are used to define an abstract |
179 | -- simplified "topology" for surfaces. This is used by |
180 | -- algorithm as mass properties or surface intersections. |
181 | -- |
182 | |
183 | |
184 | class HVertex; |
185 | |
186 | class HSurfaceTool; |
187 | |
188 | class TopolTool; |
189 | |
190 | -- |
191 | -- The following classes provides algorithmic curves and |
192 | -- surface, they are inheriting from Curve and Surface and the |
193 | -- correponding HCurve and HSurface is instantiated. |
194 | -- |
195 | -- |
196 | |
197 | |
198 | class IsoCurve; |
199 | ---Purpose: Algorithmic 3d curv, isoparametric on a surface. |
200 | |
201 | class HIsoCurve instantiates GenHCurve from Adaptor3d |
202 | (IsoCurve from Adaptor3d); |
203 | |
204 | |
205 | class CurveOnSurface; |
206 | ---Purpose: Algorithmic 3d curve from a surface and a 2d curve |
207 | -- in the parameter space. |
208 | |
209 | pointer CurveOnSurfacePtr to CurveOnSurface from Adaptor3d; |
210 | |
211 | class HCurveOnSurface instantiates GenHCurve from Adaptor3d |
212 | (CurveOnSurface from Adaptor3d); |
213 | |
214 | |
215 | |
216 | class OffsetCurve; |
217 | ---Purpose: Algorithmic 2d curve. |
218 | |
219 | class HOffsetCurve instantiates GenHCurve2d from Adaptor2d |
220 | (OffsetCurve from Adaptor3d); |
221 | |
222 | |
223 | class SurfaceOfRevolution; |
224 | ---Purpose: Algorithmic Surface from a Curve and an Axis |
225 | -- Curve and Axis are coplanar. |
226 | -- Curve doesn't intersect Axis. |
227 | |
228 | class HSurfaceOfRevolution instantiates GenHSurface from Adaptor3d |
229 | (SurfaceOfRevolution from Adaptor3d); |
230 | |
231 | |
232 | |
233 | class SurfaceOfLinearExtrusion; |
234 | ---Purpose: Algorithmic Surface from a curve and a direction |
235 | |
236 | class HSurfaceOfLinearExtrusion instantiates GenHSurface from Adaptor3d |
237 | (SurfaceOfLinearExtrusion from Adaptor3d); |
238 | |
239 | private class InterFunc; |
240 | ---Purpose: function to find the Cn discontinuity point. Used to |
241 | -- find the roots of the functions |
242 | |
243 | end Adaptor3d; |