0023839: Projection algorithm produces wrong results for set of data
[occt.git] / src / ProjLib / ProjLib_ProjectOnPlane.cdl
1 -- Created on: 1994-09-02
2 -- Created by: Bruno DUMORTIER
3 -- Copyright (c) 1994-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
21
22 class ProjectOnPlane from ProjLib inherits Curve from Adaptor3d
23
24
25     ---Purpose: Class  used  to project  a 3d curve   on a plane.  The
26     --          result will be a 3d curve.
27     --          
28     --          You  can ask   the projected curve  to  have  the same
29     --          parametrization as the original curve.
30     --           
31     --          The projection can be done  along every direction  not
32     --          parallel to the plane.
33     --          
34
35
36
37 uses
38
39     Shape             from GeomAbs,
40     CurveType         from GeomAbs,
41     Dir               from gp,
42     Ax3               from gp,
43     Vec               from gp,
44     Pnt               from gp,
45     Circ              from gp,
46     Elips             from gp,
47     Hypr              from gp,
48     Parab             from gp,
49     Lin               from gp,
50     Curve             from Adaptor3d,
51     HCurve            from GeomAdaptor,
52     HCurve            from Adaptor3d,
53     BezierCurve       from Geom,
54     BSplineCurve      from Geom,
55     Array1OfPnt       from TColgp,
56     Array1OfReal      from TColStd,
57     Array1OfInteger   from TColStd
58      
59 raises
60     
61     OutOfRange        from Standard,
62     NoSuchObject      from Standard,
63     DomainError       from Standard,
64     ConstructionError from Standard,
65     NotImplemented    from Standard
66     
67 is
68
69     Create returns ProjectOnPlane from ProjLib;
70         ---Purpose: Empty constructor.
71     
72
73     Create( Pl : Ax3 from gp) 
74         ---Purpose: The projection will be normal to the Plane defined
75         --          by the Ax3 <Pl>.
76     returns ProjectOnPlane from ProjLib;
77     
78
79     Create( Pl : Ax3 from gp;
80             D  : Dir from gp )     
81     returns ProjectOnPlane from ProjLib
82         ---Purpose: The projection will be  along the direction <D> on
83         --          the plane defined by the Ax3 <Pl>. 
84     raises 
85         ConstructionError from Standard;
86         ---Purpose: raises  if the direction  <D>  is parallel  to the
87         --          plane <Pl>.
88
89
90     Load(me : in out; 
91          C                   : HCurve  from Adaptor3d;
92          Tolerance           : Real    from Standard;
93          KeepParametrization : Boolean from Standard = Standard_True)
94         ---Purpose: Sets the  Curve  and perform  the projection.   if
95         --          <KeepParametrization> is true, the parametrization
96         --          of the Projected Curve <PC>  will  be the same  as
97         --          the parametrization of the initial  curve <C>.  It
98         --          meens: proj(C(u)) = PC(u) for  each u.  Otherwize,
99         --          the parametrization may change.
100     is static;
101     
102
103     GetPlane(me) returns Ax3 from gp
104         ---C++: return const &
105     is static;
106     
107     GetDirection (me) returns Dir from gp
108         ---C++: return const &
109     is static;
110     
111     GetCurve(me) returns HCurve from Adaptor3d 
112         ---C++: return const &
113     is static;
114
115     --
116     --     Global methods - Apply to the whole curve.
117     --     
118     
119     FirstParameter(me) returns Real
120     is redefined static;
121
122     LastParameter(me) returns Real
123     is redefined static;
124     
125     Continuity(me) returns Shape from GeomAbs
126     is redefined static;
127     
128     NbIntervals(me: in out; S : Shape from GeomAbs) returns Integer
129         ---Purpose: If necessary,  breaks the  curve in  intervals  of
130         --          continuity  <S>.    And  returns   the number   of
131         --          intervals.
132     is redefined static;
133     
134     Intervals(me: in out; T : in out Array1OfReal from TColStd; 
135                   S : Shape from GeomAbs)
136         ---Purpose: Stores in <T> the  parameters bounding the intervals
137         --          of continuity <S>.
138         --          
139         --          The array must provide  enough room to  accomodate
140         --          for the parameters. i.e. T.Length() > NbIntervals()
141     raises
142         OutOfRange from Standard 
143     is redefined static;
144
145     Trim(me; First, Last, Tol : Real) returns HCurve from Adaptor3d
146         ---Purpose: Returns    a  curve equivalent   of  <me>  between
147         --          parameters <First>  and <Last>. <Tol>  is used  to
148         --          test for 3d points confusion.
149     raises
150         OutOfRange from Standard
151         ---Purpose: If <First> >= <Last> 
152     is redefined static;
153     
154     
155     IsClosed(me) returns Boolean
156     is redefined static;
157      
158     IsPeriodic(me) returns Boolean
159     is redefined static;
160     
161     Period(me) returns Real
162     raises
163         DomainError from Standard -- if the curve is not periodic
164     is redefined static;
165      
166     Value(me; U : Real) returns Pnt from gp
167         --- Purpose : Computes the point of parameter U on the curve.
168     is redefined static;
169     
170     D0 (me; U : Real; P : out Pnt from gp)
171         --- Purpose : Computes the point of parameter U on the curve.
172     is redefined static;
173     
174     D1 (me; U : Real; P : out Pnt from gp ; V : out Vec from gp)
175         --- Purpose : Computes the point of parameter U on the curve with its
176         --  first derivative.
177     raises 
178         DomainError from Standard
179         --- Purpose : Raised if the continuity of the current interval
180         --  is not C1.
181     is redefined static;
182     
183     D2 (me; U : Real; P : out Pnt from gp; V1, V2 : out Vec from gp)
184         --- Purpose :
185         --  Returns the point P of parameter U, the first and second
186         --  derivatives V1 and V2.
187     raises 
188         DomainError from Standard
189         --- Purpose : Raised if the continuity of the current interval
190         --  is not C2.
191     is redefined static;
192
193     D3 (me; U : Real; P : out Pnt from gp; V1, V2, V3 : out Vec from gp)
194         --- Purpose :
195         --  Returns the point P of parameter U, the first, the second 
196         --  and the third derivative.
197     raises 
198         DomainError from Standard
199         --- Purpose : Raised if the continuity of the current interval
200         --  is not C3.
201     is redefined static;
202         
203     DN (me; U : Real; N : Integer)   returns Vec from gp
204         --- Purpose :
205         --  The returned vector gives the value of the derivative for the 
206         --  order of derivation N.
207     raises  
208         DomainError from Standard,
209         --- Purpose : Raised if the continuity of the current interval
210         --  is not CN.
211         OutOfRange from Standard
212         --- Purpose : Raised if N < 1.            
213     is redefined static;
214
215     Resolution(me; R3d : Real) returns Real
216          ---Purpose :  Returns the parametric  resolution corresponding
217          --         to the real space resolution <R3d>.
218     is redefined static;   
219         
220     GetType(me) returns CurveType from GeomAbs
221         ---Purpose: Returns  the  type of the   curve  in the  current
222         --          interval :   Line,   Circle,   Ellipse, Hyperbola,
223         --          Parabola, BezierCurve, BSplineCurve, OtherCurve.
224     is redefined static;
225
226     --
227     --     The following methods must  be called when GetType returned
228     --     the corresponding type.
229     --     
230
231     Line(me) returns Lin from gp
232     raises 
233         NoSuchObject from Standard
234     is redefined static;
235     
236     Circle(me) returns Circ from gp
237     raises 
238         NoSuchObject from Standard
239     is redefined static;
240     
241     Ellipse(me) returns Elips from gp
242     raises 
243         NoSuchObject from Standard
244     is redefined static;
245     
246     Hyperbola(me) returns  Hypr from gp
247     raises 
248         NoSuchObject from Standard
249     is redefined static;
250     
251     Parabola(me) returns Parab from gp
252     raises 
253         NoSuchObject from Standard
254     is redefined static;
255     
256      
257      Degree(me) returns Integer
258      raises 
259         NoSuchObject from Standard
260      is redefined static;
261      
262      IsRational(me) returns Boolean
263      raises 
264         NoSuchObject from Standard
265      is redefined static;
266      
267      NbPoles(me) returns Integer
268      raises 
269         NoSuchObject from Standard
270      is redefined static;
271      
272     
273      NbKnots(me) returns Integer
274      raises 
275         NoSuchObject from Standard
276      is redefined static;
277      
278
279     Bezier(me) returns BezierCurve from Geom
280     raises 
281         NoSuchObject from Standard
282     is redefined static;
283         ---Purpose:  Warning ! this will NOT make a copy of the
284         --         Bezier Curve : If you want to modify
285         --         the Curve please make a copy yourself
286         --         Also it will NOT trim the surface to
287         --         myFirst/Last.
288     
289     BSpline(me) returns BSplineCurve from Geom
290     raises 
291         NoSuchObject from Standard
292     is redefined static;
293         ---Purpose:  Warning ! this will NOT make a copy of the
294         --         BSpline Curve : If you want to modify
295         --         the Curve please make a copy yourself
296         --         Also it will NOT trim the surface to
297         --         myFirst/Last.
298      
299
300 fields
301     
302      myCurve     : HCurve    from Adaptor3d ;
303      myPlane     : Ax3       from gp;
304      myDirection : Dir       from gp;
305      myKeepParam : Boolean   from Standard;
306      myFirstPar  : Real      from Standard;
307      myLastPar   : Real      from Standard;
308      myTolerance : Real      from Standard;
309      -- the tolerance to make the approximation if
310      -- necessary
311      myType      : CurveType from GeomAbs;
312      myResult    : HCurve    from GeomAdaptor ;
313      myIsApprox  : Boolean   from Standard;
314      
315      -- the result of the approximation 
316      
317 end ProjectOnPlane;