0026377: Passing Handle objects as arguments to functions as non-const reference...
[occt.git] / src / IntWalk / IntWalk_IWalking_6.gxx
1 // Copyright (c) 1995-1999 Matra Datavision
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 //
4 // This file is part of Open CASCADE Technology software library.
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
11 //
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
14
15 #ifndef OCCT_DEBUG
16 #define No_Standard_RangeError
17 #define No_Standard_OutOfRange
18 #endif
19
20
21 void IntWalk_IWalking::AddPointInCurrentLine
22          (const Standard_Integer N,
23           const ThePointOfPath& PathPnt,
24           const Handle(IntWalk_TheIWLine)& CurrentLine) const {
25
26
27   IntSurf_PntOn2S Psol;
28   Psol.SetValue(ThePointOfPathTool::Value3d(PathPnt),
29                 reversed,wd1[N].ustart,wd1[N].vstart);
30   CurrentLine->AddPoint(Psol);
31 }
32
33
34 void IntWalk_IWalking::MakeWalkingPoint
35          (const Standard_Integer Case, 
36           const Standard_Real U, 
37           const Standard_Real V,
38           TheIWFunction& sp,
39           IntSurf_PntOn2S& Psol )
40
41 {
42
43 // Case == 1      : make a WalkinkPoint.
44 // Case == 2      : make a WalkinkPoint.
45 //                  The computation of the tangency on is done  
46 // Case == 10 + i : make a WalkinkPoint according to i.
47 //                  but F is updated according to U and V
48 // Case == other  : the exception Standard_Failure is raised.
49
50   if (Case == 1) 
51     Psol.SetValue(sp.Point(),reversed, U, V);
52   else if (Case == 2) {
53     Psol.SetValue(sp.Point(),reversed, U, V);
54   }
55   else if (Case == 11 || Case == 12 ) {
56     Standard_Real aUV[2], aFF[1], aDD[1][2];
57     math_Vector UV(aUV,1, 2);
58     math_Vector FF(aFF,1, 1);
59     math_Matrix DD(aDD,1, 1, 1, 2); 
60     UV(1) = U;
61     UV(2) = V;
62     sp.Values(UV, FF, DD);
63     MakeWalkingPoint(Case - 10, U, V, sp, Psol); 
64   }
65   else {
66     Standard_ConstructionError::Raise();
67   }
68
69
70 }
71
72
73
74 void IntWalk_IWalking::OpenLine(const Standard_Integer N,
75                                 const IntSurf_PntOn2S& Psol,
76                                 const ThePOPIterator& Pnts1,
77                                 TheIWFunction& sp,
78                                 const Handle(IntWalk_TheIWLine)& Line )
79 // **************** open the line and restart in the other direction********
80
81 {
82   ThePointOfPath PathPnt;
83
84   Standard_Real aUV[2], aFF[1], aDD[1][2];
85   math_Vector UV(aUV,1, 2);
86   math_Vector FF(aFF,1, 1);
87   math_Matrix DD(aDD,1, 1, 1, 2); 
88
89   previousPoint = Line->Value(1);  
90   if (!reversed) {
91     previousPoint.ParametersOnS2(UV(1),UV(2));
92   }
93   else {
94     previousPoint.ParametersOnS1(UV(1),UV(2));
95   }
96   sp.Values(UV, FF, DD);
97   previousd3d = sp.Direction3d();
98   previousd2d = sp.Direction2d();
99
100   if (N>0) { //departure point given at input
101     PathPnt = Pnts1.Value(N);
102     //mark the line as open with a given stop point
103     Line->AddStatusFirst(Standard_False,Standard_True,N,PathPnt); 
104
105
106     AddPointInCurrentLine(N,PathPnt,Line);
107
108   }
109   else  {
110     if (N <0) Line->AddPoint(Psol);                      
111     Line->AddStatusFirst(Standard_False,Standard_False);
112        //mark the line as open without given stop point 
113   }
114   Line->Reverse();  //inverser la ligne        
115   Line->SetTangentVector(previousd3d.Reversed(),Line->NbPoints());
116 }
117
118
119
120
121
122
123
124