e1614170c9be5a0b4f397a5bd4e933bb9cd0edcf
[occt.git] / src / IntWalk / IntWalk_PWalking.lxx
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 #include <StdFail_NotDone.hxx>
16 #include <IntSurf_LineOn2S.hxx>
17
18 inline Standard_Boolean IntWalk_PWalking::IsDone() const {
19   return done; 
20 }
21
22 inline Standard_Integer IntWalk_PWalking::NbPoints() const {
23   if(!done) StdFail_NotDone::Raise();
24   return line->NbPoints();
25 }
26
27 inline const IntSurf_PntOn2S& IntWalk_PWalking::Value
28   (const Standard_Integer Index) const
29 {
30   if (!done) StdFail_NotDone::Raise();
31   return line->Value(Index);
32 }
33
34
35 inline const Handle(IntSurf_LineOn2S)& IntWalk_PWalking::Line () const {
36
37   if (!done) StdFail_NotDone::Raise();
38   return line;
39 }
40
41
42 inline Standard_Boolean IntWalk_PWalking::TangentAtFirst() const{ 
43   if(!done) StdFail_NotDone::Raise();
44   return tgfirst;
45 }
46
47 inline Standard_Boolean IntWalk_PWalking::TangentAtLast() const{ 
48   if(!done) StdFail_NotDone::Raise();
49   return tglast;
50 }
51
52 inline Standard_Boolean IntWalk_PWalking::IsClosed() const{ 
53   if(!done) StdFail_NotDone::Raise();
54   return close;
55 }
56
57 inline const gp_Dir& IntWalk_PWalking::TangentAtLine
58   (Standard_Integer& Index) const
59 {
60   if(!done) StdFail_NotDone::Raise();
61   Index = indextg;
62   return tgdir;
63 }
64
65 #define REGLAGE 0
66
67 inline void IntWalk_PWalking::AddAPoint(Handle(IntSurf_LineOn2S)& theLine,
68                                         const IntSurf_PntOn2S& POn2S) { 
69 #if REGLAGE
70   Standard_Integer n=theLine->NbPoints();
71   if(n) { 
72     gp_Vec V(POn2S.Value(),theLine->Value(n).Value());
73     Standard_Real u1,v1,u2,v2;
74     Standard_Real U1,V1,U2,V2;
75     POn2S.Parameters(u1,v1,u2,v2);
76     theLine->Value(n).Parameters(U1,V1,U2,V2);
77     printf("\n%3d: (%10.5g)(%+12.5g %+12.5g %+12.5g) (%+12.5g %+12.5g) (%+12.5g %+12.5g)",n,
78            V.Magnitude(),V.X(),V.Y(),V.Z(),U1-u1,V1-v1,U2-u2,V2-v2);
79     fflush(stdout);
80   }
81 #endif
82   theLine->Add(POn2S);  
83 }
84
85