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 Adaptor2d |
26 | |
27 | ---Purpose: The Adaptor2d 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 objects : |
32 | -- |
33 | -- - the 2d curve. Curve2d |
34 | -- |
35 | -- The services are : |
36 | -- |
37 | -- - Usual services found in Geom or Geom2d : |
38 | -- |
39 | -- * parameter range, value and derivatives, etc... |
40 | -- |
41 | -- - Continuity breakout services : |
42 | -- |
43 | -- * Allows to divide a curve or a surfaces in |
44 | -- parts with a given derivation order. |
45 | -- |
46 | -- - Special geometries detection services : |
47 | -- |
48 | -- * Allows to test for special cases that can |
49 | -- be processed more easily : |
50 | -- - Conics, Quadrics, Bezier, BSpline ... |
51 | -- |
52 | -- And to get the correponding data form the |
53 | -- package gp or Geom. The special type |
54 | -- OtherCurve means that no special case has |
55 | -- been detected and the algorithm may use |
56 | -- only the evaluation methods (D0, D1, ...) |
57 | -- |
58 | -- |
59 | -- For each category Curve2d, Curve, Surface we |
60 | -- define three classes, we illustrate now the |
61 | -- principles with the Curve, the same applies to |
62 | -- Curve2d and Surface. |
63 | -- |
64 | -- The class Curve is the abstract root for all |
65 | -- Curves used by algorithms, it is handled by value |
66 | -- and provides as deferred methods the services |
67 | -- described above. |
68 | -- |
69 | -- Some services (breakout) requires to create new |
70 | -- curves, this leads to memory allocation |
71 | -- considerations (who create the curve, who deletes |
72 | -- it ?). To solve this problem elegantly the curve |
73 | -- will return a HCurve, the HCurve is a curve |
74 | -- handled by reference so it will be deallocated |
75 | -- automatically when it is not used. |
76 | -- |
77 | -- A third class GenHCurve is provided, this class is |
78 | -- generic and its utility is to provide automatic |
79 | -- generation of the HCurve class when you have |
80 | -- written the Curve class. |
81 | -- |
82 | -- |
83 | -- * Let us show an example (with 2d curves) : |
84 | -- |
85 | -- Imagine an algorithm to intersect curves, this |
86 | -- algorithms is written to process Curve2d from |
87 | -- Adaptor2d : |
88 | -- |
89 | -- A method may look like : |
90 | -- |
91 | -- Intersect(C1,C2 : Curve2d from Adaptor2d); |
92 | -- |
93 | -- Which will look like in C++ |
94 | -- |
95 | -- Intersect(const Adaptor2d_Curve2d& C1, |
96 | -- const Adaptor2d_Curve2d& C2) |
97 | -- { |
98 | -- // you can call any method |
99 | -- Standard_Real first1 = C1.FirstParameter(); |
100 | -- |
101 | -- // but avoid to copy in an Adaptor2d_Curve which |
102 | -- // is an Abstract class, use a reference or a pointer |
103 | -- |
104 | -- const Adaptor2d_Curve& C = C1; |
105 | -- const Adaptor2d_Curve *pC = &C1; |
106 | -- |
107 | -- // If you are interseted in Intervals you must |
108 | -- // store them in a HCurve to ensure they are kept |
109 | -- // in memory. Then a referrence may be used. |
110 | -- |
111 | -- Handle(Adaptor2d_HCurve) HCI = C1.Interval(1); |
112 | -- |
113 | -- const Adaptor2d_Curve& CI = HCI->Curve(); |
114 | -- pC = &(HCI->Curve()); |
115 | -- |
116 | -- |
117 | -- * The Adaptor2d provides also Generic classes |
118 | -- implementing algorithmic curves and surfaces. |
119 | -- |
120 | -- - IsoCurve : Isoparametric curve on a surface. |
121 | -- - CurveOnSurface : 2D curve in the parametric |
122 | -- space of a surface. |
123 | -- |
124 | -- |
125 | -- - OffsetCurve2d : 2d offset curve |
126 | -- - ProjectedCurve : 3d curve projected on a plane |
127 | -- - SurfaceOfLinearExtrusion |
128 | -- - SurfaceOfRevolution |
129 | -- |
130 | -- They are instantiated with HCurve, HSurface, HCurved2d |
131 | |
132 | uses |
133 | Standard, |
134 | MMgt, |
135 | TColStd, |
136 | GeomAbs, |
7fd59977 |
137 | TColgp, |
138 | gp, |
139 | Geom2d, |
140 | math |
141 | |
142 | is |
143 | |
144 | deferred class Curve2d; |
145 | ---Purpose: Root of the 2d curve. |
146 | |
147 | pointer Curve2dPtr to Curve2d from Adaptor2d; |
148 | |
149 | deferred class HCurve2d; |
150 | ---Purpose: deferred class for the 2d curves manipulated with |
151 | -- Handle. |
152 | |
153 | generic class GenHCurve2d; |
154 | ---Purpose: Generic class used to create a curve inheriting |
155 | -- from HCurve2d. |
156 | |
157 | |
158 | |
159 | -- |
160 | -- The following classes are used to define an abstract |
161 | -- simplified "topology" for surfaces. This is used by |
162 | -- algorithm as mass properties or surface intersections. |
163 | -- |
164 | |
165 | |
166 | class Line2d; |
167 | |
168 | class HLine2d instantiates GenHCurve2d(Line2d from Adaptor2d); |
169 | ---Purpose: Use by the TopolTool to trim a surface. |
170 | |
171 | -- |
172 | -- The following classes provides algorithmic curves and |
173 | -- surface, they are inheriting from Curve and Surface and the |
174 | -- correponding HCurve and HSurface is instantiated. |
175 | -- |
176 | -- |
177 | |
178 | |
179 | |
180 | end Adaptor2d; |