0026377: Passing Handle objects as arguments to functions as non-const reference...
[occt.git] / src / IntWalk / IntWalk_PWalking.hxx
CommitLineData
42cf5bc1 1// Created on: 1992-04-03
2// Created by: Isabelle GRIGNON
3// Copyright (c) 1992-1999 Matra Datavision
4// Copyright (c) 1999-2014 OPEN CASCADE SAS
5//
6// This file is part of Open CASCADE Technology software library.
7//
8// This library is free software; you can redistribute it and/or modify it under
9// the terms of the GNU Lesser General Public License version 2.1 as published
10// by the Free Software Foundation, with special exception defined in the file
11// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12// distribution for complete text of the license and disclaimer of any warranty.
13//
14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
16
17#ifndef _IntWalk_PWalking_HeaderFile
18#define _IntWalk_PWalking_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
24#include <Standard_Boolean.hxx>
25#include <Standard_Integer.hxx>
26#include <gp_Dir.hxx>
27#include <Standard_Real.hxx>
28#include <IntImp_ConstIsoparametric.hxx>
29#include <IntSurf_PntOn2S.hxx>
30#include <gp_Dir2d.hxx>
31#include <IntWalk_TheInt2S.hxx>
32#include <TColStd_Array1OfReal.hxx>
33#include <IntWalk_StatusDeflection.hxx>
34class IntSurf_LineOn2S;
35class Standard_OutOfRange;
36class StdFail_NotDone;
37class Adaptor3d_HSurface;
38class IntSurf_PntOn2S;
39class gp_Dir;
40class gp_Pnt;
41
42
43//! This class implements an algorithm to determine the
44//! intersection between 2 parametrized surfaces, marching from
45//! a starting point. The intersection line
46//! starts and ends on the natural surface's boundaries .
47class IntWalk_PWalking
48{
49public:
50
51 DEFINE_STANDARD_ALLOC
52
53
54 //! Constructor used to set the data to compute intersection
55 //! lines between Caro1 and Caro2.
56 //! Deflection is the maximum deflection admitted between two
57 //! consecutive points on the resulting polyline.
58 //! TolTangency is the tolerance to find a tangent point.
59 //! Func is the criterion which has to be evaluated at each
60 //! solution point (each point of the line).
61 //! It is necessary to call the Perform method to compute
62 //! the intersection lines.
63 //! The line found starts at a point on or in 2 natural domains
64 //! of surfaces. It can be closed in the
65 //! standard case if it is open it stops and begins at the
66 //! border of one of the domains. If an open line
67 //! stops at the middle of a domain, one stops at the tangent point.
68 //! Epsilon is SquareTolerance of points confusion.
69 Standard_EXPORT IntWalk_PWalking(const Handle(Adaptor3d_HSurface)& Caro1, const Handle(Adaptor3d_HSurface)& Caro2, const Standard_Real TolTangency, const Standard_Real Epsilon, const Standard_Real Deflection, const Standard_Real Increment);
70
71 //! Returns the intersection line containing the exact
72 //! point Poin. This line is a polygonal line.
73 //! Deflection is the maximum deflection admitted between two
74 //! consecutive points on the resulting polyline.
75 //! TolTangency is the tolerance to find a tangent point.
76 //! Func is the criterion which has to be evaluated at each
77 //! solution point (each point of the line).
78 //! The line found starts at a point on or in 2 natural domains
79 //! of surfaces. It can be closed in the
80 //! standard case if it is open it stops and begins at the
81 //! border of one of the domains. If an open line
82 //! stops at the middle of a domain, one stops at the tangent point.
83 //! Epsilon is SquareTolerance of points confusion.
84 Standard_EXPORT IntWalk_PWalking(const Handle(Adaptor3d_HSurface)& Caro1, const Handle(Adaptor3d_HSurface)& Caro2, const Standard_Real TolTangency, const Standard_Real Epsilon, const Standard_Real Deflection, const Standard_Real Increment, const Standard_Real U1, const Standard_Real V1, const Standard_Real U2, const Standard_Real V2);
85
86 //! calculate the line of intersection
87 Standard_EXPORT void Perform (const TColStd_Array1OfReal& ParDep);
88
89 //! calculate the line of intersection. The regulation
90 //! of steps is done using min and max values on u and
91 //! v. (if this data is not presented as in the
92 //! previous method, the initial steps are calculated
93 //! starting from min and max uv of faces).
94 Standard_EXPORT void Perform (const TColStd_Array1OfReal& ParDep, const Standard_Real u1min, const Standard_Real v1min, const Standard_Real u2min, const Standard_Real v2min, const Standard_Real u1max, const Standard_Real v1max, const Standard_Real u2max, const Standard_Real v2max);
95
96 //! calculate the first point of a line of intersection
97 Standard_EXPORT Standard_Boolean PerformFirstPoint (const TColStd_Array1OfReal& ParDep, IntSurf_PntOn2S& FirstPoint);
98
99 //! Returns true if the calculus was successful.
100 Standard_Boolean IsDone() const;
101
102 //! Returns the number of points of the resulting polyline.
103 //! An exception is raised if IsDone returns False.
104 Standard_Integer NbPoints() const;
105
106 //! Returns the point of range Index on the polyline.
107 //! An exception is raised if IsDone returns False.
108 //! An exception is raised if Index<=0 or Index>NbPoints.
109 const IntSurf_PntOn2S& Value (const Standard_Integer Index) const;
110
111 const Handle(IntSurf_LineOn2S)& Line() const;
112
113 //! Returns True if the surface are tangent at the first point
114 //! of the line.
115 //! An exception is raised if IsDone returns False.
116 Standard_Boolean TangentAtFirst() const;
117
118 //! Returns true if the surface are tangent at the last point
119 //! of the line.
120 //! An exception is raised if IsDone returns False.
121 Standard_Boolean TangentAtLast() const;
122
123 //! Returns True if the line is closed.
124 //! An exception is raised if IsDone returns False.
125 Standard_Boolean IsClosed() const;
126
127 const gp_Dir& TangentAtLine (Standard_Integer& Index) const;
128
6fa29cbf 129 Standard_EXPORT IntWalk_StatusDeflection TestDeflection (const IntImp_ConstIsoparametric ChoixIso) ;
42cf5bc1 130
131 Standard_EXPORT Standard_Boolean TestArret (const Standard_Boolean DejaReparti, TColStd_Array1OfReal& Param, IntImp_ConstIsoparametric& ChoixIso);
132
133 Standard_EXPORT void RepartirOuDiviser (Standard_Boolean& DejaReparti, IntImp_ConstIsoparametric& ChoixIso, Standard_Boolean& Arrive);
134
135 void AddAPoint (Handle(IntSurf_LineOn2S)& line, const IntSurf_PntOn2S& POn2S);
136
137 Standard_EXPORT Standard_Boolean PutToBoundary (const Handle(Adaptor3d_HSurface)& theASurf1, const Handle(Adaptor3d_HSurface)& theASurf2);
138
139 Standard_EXPORT Standard_Boolean SeekAdditionalPoints (const Handle(Adaptor3d_HSurface)& theASurf1, const Handle(Adaptor3d_HSurface)& theASurf2, const Standard_Integer theMinNbPoints);
140
714c3bfc 141 Standard_Real MaxStep(Standard_Integer theIndex)
142 {
143 Standard_OutOfRange_Raise_if((theIndex < 0) || (theIndex > 3), "");
144 return pasInit[theIndex];
145 }
42cf5bc1 146
147
148
149protected:
714c3bfc 150 Standard_EXPORT void ComputePasInit(const Standard_Real theDeltaU1,
151 const Standard_Real theDeltaV1,
152 const Standard_Real theDeltaU2,
153 const Standard_Real theDeltaV2);
42cf5bc1 154
155
156
157
158
159private:
160
161
162 Standard_EXPORT Standard_Boolean ExtendLineInCommonZone (const IntImp_ConstIsoparametric theChoixIso, const Standard_Boolean theDirectionFlag);
163
164 Standard_EXPORT Standard_Boolean DistanceMinimizeByGradient (const Handle(Adaptor3d_HSurface)& theASurf1, const Handle(Adaptor3d_HSurface)& theASurf2, Standard_Real& theU1, Standard_Real& theV1, Standard_Real& theU2, Standard_Real& theV2, const Standard_Real theStep0U1V1 = 1.0e-6, const Standard_Real theStep0U2V2 = 1.0e-6);
165
166 Standard_EXPORT Standard_Boolean DistanceMinimizeByExtrema (const Handle(Adaptor3d_HSurface)& theASurf1, const gp_Pnt& theP0, Standard_Real& theU0, Standard_Real& theV0, const Standard_Real theStep0U = 1.0, const Standard_Real theStep0V = 1.0);
167
168 Standard_EXPORT Standard_Boolean SeekPointOnBoundary (const Handle(Adaptor3d_HSurface)& theASurf1, const Handle(Adaptor3d_HSurface)& theASurf2, const Standard_Real theU1, const Standard_Real theV1, const Standard_Real theU2, const Standard_Real theV2, const Standard_Boolean isTheFirst);
169
170
171 Standard_Boolean done;
172 Handle(IntSurf_LineOn2S) line;
173 Standard_Boolean close;
174 Standard_Boolean tgfirst;
175 Standard_Boolean tglast;
176 Standard_Integer indextg;
177 gp_Dir tgdir;
178 Standard_Real fleche;
179 Standard_Real pasMax;
180 Standard_Real tolconf;
714c3bfc 181 Standard_Real myTolTang;
42cf5bc1 182 Standard_Real pasuv[4];
714c3bfc 183 Standard_Real myStepMin[4];
42cf5bc1 184 Standard_Real pasSav[4];
185 Standard_Real pasInit[4];
186 Standard_Real Um1;
187 Standard_Real UM1;
188 Standard_Real Vm1;
189 Standard_Real VM1;
190 Standard_Real Um2;
191 Standard_Real UM2;
192 Standard_Real Vm2;
193 Standard_Real VM2;
194 Standard_Real ResoU1;
195 Standard_Real ResoU2;
196 Standard_Real ResoV1;
197 Standard_Real ResoV2;
198 Standard_Integer sensCheminement;
199 IntImp_ConstIsoparametric choixIsoSav;
200 IntSurf_PntOn2S previousPoint;
201 Standard_Boolean previoustg;
202 gp_Dir previousd;
203 gp_Dir2d previousd1;
204 gp_Dir2d previousd2;
205 gp_Dir2d firstd1;
206 gp_Dir2d firstd2;
207 IntWalk_TheInt2S myIntersectionOn2S;
208 Standard_Integer STATIC_BLOCAGE_SUR_PAS_TROP_GRAND;
209 Standard_Integer STATIC_PRECEDENT_INFLEXION;
210
211
212};
213
214
215#include <IntWalk_PWalking.lxx>
216
217
218
219
220
221#endif // _IntWalk_PWalking_HeaderFile