summaryrefslogtreecommitdiff
path: root/inc/IntWalk_IWalking_6.gxx
blob: 16e581a1abb2af67091cd924bc272d3ce0f5263a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
//-- File IntWalk_IWalking_6.gxx

#ifndef DEB
#define No_Standard_RangeError
#define No_Standard_OutOfRange
#endif


void IntWalk_IWalking::AddPointInCurrentLine
         (const Standard_Integer N,
	  const ThePointOfPath& PathPnt,
	  const Handle(IntWalk_TheIWLine)& CurrentLine) const {


  IntSurf_PntOn2S Psol;
  Psol.SetValue(ThePointOfPathTool::Value3d(PathPnt),
		reversed,ustart1(N),vstart1(N));
  CurrentLine->AddPoint(Psol);
}


void IntWalk_IWalking::MakeWalkingPoint
         (const Standard_Integer Case, 
	  const Standard_Real U, 
	  const Standard_Real V,
	  TheIWFunction& sp,
	  IntSurf_PntOn2S& Psol )

{

// Case == 1      : make a WalkinkPoint.
// Case == 2      : make a WalkinkPoint.
//                  The computation of the tangency on is done  
// Case == 10 + i : make a WalkinkPoint according to i.
//                  but F is updated according to U and V
// Case == other  : the exception Standard_Failure is raised.

  if (Case == 1) 
    Psol.SetValue(sp.Point(),reversed, U, V);
  else if (Case == 2) {
    Psol.SetValue(sp.Point(),reversed, U, V);
  }
  else if (Case == 11 || Case == 12 ) {
    static math_Vector UV(1, 2);
    static math_Vector FF(1, 1);
    static math_Matrix DD(1, 1, 1, 2); 
    UV(1) = U;
    UV(2) = V;
    sp.Values(UV, FF, DD);
    MakeWalkingPoint(Case - 10, U, V, sp, Psol); 
  }
  else {
    Standard_ConstructionError::Raise();
  }


}



void IntWalk_IWalking::OpenLine(const Standard_Integer N,
                                const IntSurf_PntOn2S& Psol,
				const ThePOPIterator& Pnts1,
				TheIWFunction& sp,
                                const Handle(IntWalk_TheIWLine)& Line )
// **************** ouverture de la ligne et repartir dans l autre sens********

{
  ThePointOfPath PathPnt;

  static math_Vector UV(1, 2);
  static math_Vector FF(1, 1);
  static math_Matrix DD(1, 1, 1, 2); 

  previousPoint = Line->Value(1);  
  if (!reversed) {
    previousPoint.ParametersOnS2(UV(1),UV(2));
  }
  else {
    previousPoint.ParametersOnS1(UV(1),UV(2));
  }
  sp.Values(UV, FF, DD);
  previousd3d = sp.Direction3d();
  previousd2d = sp.Direction2d();

  if (N>0) { //point de depart donne en entree
    PathPnt = Pnts1.Value(N);
    //marque la ligne comme ouverte avec point d arret donne
    Line->AddStatusFirst(Standard_False,Standard_True,N,PathPnt); 


    AddPointInCurrentLine(N,PathPnt,Line);

  }
  else  {
    if (N <0) Line->AddPoint(Psol);                      
    Line->AddStatusFirst(Standard_False,Standard_False);
       //marque la ligne comme ouverte sans point d arret donne
  }
  Line->Reverse();  //inverser la ligne        
  Line->SetTangentVector(previousd3d.Reversed(),Line->NbPoints());
}