0023952: Improving thread-safety of intersections, approximations and other modeling...
[occt.git] / src / IntWalk / IntWalk_IWLine.lxx
CommitLineData
b311480e 1// Copyright (c) 1995-1999 Matra Datavision
2// Copyright (c) 1999-2012 OPEN CASCADE SAS
3//
4// The content of this file is subject to the Open CASCADE Technology Public
5// License Version 6.5 (the "License"). You may not use the content of this file
6// except in compliance with the License. Please obtain a copy of the License
7// at http://www.opencascade.org and read it completely before using this file.
8//
9// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
10// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
11//
12// The Original Code and all software distributed under the License is
13// distributed on an "AS IS" basis, without warranty of any kind, and the
14// Initial Developer hereby disclaims all such warranties, including without
15// limitation, any warranties of merchantability, fitness for a particular
16// purpose or non-infringement. Please see the License for the specific terms
17// and conditions governing the rights and limitations under the License.
18
7fd59977 19#ifndef Standard_DomainError_HeaderFile
20#include <Standard_DomainError.hxx>
21#endif
22#ifndef IntSurf_LineOn2S_HeaderFile
23#include <IntSurf_LineOn2S.hxx>
24#endif
25#ifndef IntSurf_Couple_HeaderFile
26#include <IntSurf_Couple.hxx>
27#endif
28#ifndef IntSurf_SequenceOfCouple_HeaderFile
29#include <IntSurf_SequenceOfCouple.hxx>
30#endif
31
32inline void IntWalk_IWLine::Cut(const Standard_Integer Index)
33{
34//-- cout<<" split : "<<Index<<endl;
35 Handle(IntSurf_LineOn2S) lost = line->Split(Index);
36}
37
38inline void IntWalk_IWLine::AddPoint(const IntSurf_PntOn2S& P)
39{
40 line->Add(P);
41}
42
43inline void IntWalk_IWLine::AddStatusFirst(const Standard_Boolean Closed,
44 const Standard_Boolean HasFirst)
45{
46 closed = Closed;
47 hasFirst = HasFirst;
48}
49
50inline void IntWalk_IWLine::AddStatusLast (const Standard_Boolean HasLast)
51{
52 hasLast = HasLast;
53}
54
55inline void IntWalk_IWLine::AddStatusFirst(const Standard_Boolean Closed,
56 const Standard_Boolean HasFirst,
57 const Standard_Integer Index,
58 const TheStartPoint& P ) {
59 closed = Closed;
60 hasFirst = HasFirst;
61 firstIndex = Index;
62 theFirstPoint = P;
63}
64
65inline void IntWalk_IWLine::AddStatusLast(const Standard_Boolean HasLast,
66 const Standard_Integer Index,
67 const TheStartPoint& P ) {
68 hasLast = HasLast;
69 lastIndex = Index;
70 theLastPoint = P;
71}
72
73inline void IntWalk_IWLine::AddStatusFirstLast(const Standard_Boolean Closed,
74 const Standard_Boolean HasFirst,
75 const Standard_Boolean HasLast )
76{
77 closed = Closed;
78 hasFirst = HasFirst;
79 hasLast = HasLast;
80}
81
82inline void IntWalk_IWLine::AddIndexPassing(const Standard_Integer Index)
83
84{
85 couple.Append(IntSurf_Couple(line->NbPoints()+1, Index));
86}
87
88inline Standard_Integer IntWalk_IWLine::NbPoints() const
89{
90 return line->NbPoints();
91}
92
93inline const IntSurf_PntOn2S& IntWalk_IWLine::Value
94 (const Standard_Integer Index) const
95{
96 return line->Value(Index);
97}
98
99inline const Handle(IntSurf_LineOn2S)& IntWalk_IWLine::Line () const
100{
101 return line;
102}
103
104inline Standard_Boolean IntWalk_IWLine::IsClosed() const
105{
106 return closed;
107}
108
109inline Standard_Boolean IntWalk_IWLine::HasFirstPoint() const
110{
111 return hasFirst;
112}
113
114inline Standard_Integer IntWalk_IWLine::FirstPointIndex() const
115{
116 if (!hasFirst) Standard_DomainError::Raise();
117 return firstIndex;
118}
119
120inline const TheStartPoint& IntWalk_IWLine::FirstPoint() const
121{
122 if (!hasFirst) Standard_DomainError::Raise();
123 return theFirstPoint;
124}
125
126inline Standard_Boolean IntWalk_IWLine::HasLastPoint() const
127{
128 return hasLast;
129}
130
131inline const TheStartPoint& IntWalk_IWLine::LastPoint() const
132{
133 if (!hasLast) Standard_DomainError::Raise();
134 return theLastPoint;
135}
136
137inline Standard_Integer IntWalk_IWLine::LastPointIndex() const
138{
139 if (!hasLast) Standard_DomainError::Raise();
140 return lastIndex;
141}
142
143inline Standard_Integer IntWalk_IWLine::NbPassingPoint() const
144{
145 return couple.Length();
146}
147
148inline void IntWalk_IWLine::PassingPoint(const Standard_Integer Index,
149 Standard_Integer& IndexLine,
150 Standard_Integer& IndexPnts) const
151{
152 IndexLine = couple(Index).First();
153 IndexPnts = couple(Index).Second();
154}
155
156inline void IntWalk_IWLine::SetTangentVector (const gp_Vec& V,
157 const Standard_Integer Index) {
158 indextg = Index;
159 vcttg = V;
160
161 //-- cout<<"\n IntWalk_IWLine::SetTangentVector : "<<V.X()<<" "<<V.Y()<<" "<<V.Z()<<" Ind:"<<Index<<" NbPts:"<<NbPoints()<<endl;
162
163}
164
165inline void IntWalk_IWLine::SetTangencyAtBegining
166 (const Standard_Boolean IsTangent) {
167
168 istgtend = IsTangent;
169}
170
171inline void IntWalk_IWLine::SetTangencyAtEnd
172 (const Standard_Boolean IsTangent) {
173
174 istgtend = IsTangent;
175}
176
177inline const gp_Vec& IntWalk_IWLine::TangentVector
178 (Standard_Integer& Index) const {
179//-- if(istgtend == Standard_False && istgtbeg == Standard_False) {
180//-- cout<<" IntWalk_IWLine.lxx : Pb "<<endl;
181//-- }
182 Index = indextg;
183 return vcttg;
184}
185
186inline Standard_Boolean IntWalk_IWLine::IsTangentAtBegining () const {
187
188 return istgtbeg;
189}
190
191inline Standard_Boolean IntWalk_IWLine::IsTangentAtEnd () const {
192
193 return istgtend;
194}
195
196