1 // Copyright (c) 1995-1999 Matra Datavision
2 // Copyright (c) 1999-2012 OPEN CASCADE SAS
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.
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.
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.
20 #include <OSD_Chronometer.hxx>
21 OSD_Chronometer Chronrsnld;
25 #include <Precision.hxx>
27 IntWalk_IWalking::IntWalk_IWalking (const Standard_Real Epsilon,
28 const Standard_Real Deflection,
29 const Standard_Real Increment ) :
34 epsilon(Epsilon*Epsilon)
39 // ***************************************************************************
40 // etat1=12 pas tangent,pas passant
41 // etat1=11 tangent,pas passant
42 // etat1=2 pas tangent,passant
43 // etat1=1 tangent,passant
44 // lorsque un point a ete traite son etat devient negatif.
45 // ***************************************************************************
46 // etat2=13 point de demarage interieur sur ligne ferme
47 // etat2=12 point de demarage interieur sur ligne ouverte
48 // (ligne initialement fermee -> la ligne s est ouverte)
49 // lorsque un point a ete traite (ou si on passe dessus lors du
50 // cheminement) son etat devient negatif.
51 // ****************************************************************************
54 // Perform avec points interieurs
56 void IntWalk_IWalking::Perform(const ThePOPIterator& Pnts1,
57 const ThePOLIterator& Pnts2,
59 const ThePSurface& Caro,
60 const Standard_Boolean Reversed)
65 ThePointOfPath PathPnt;
66 Standard_Boolean Rajout = Standard_False;
67 Standard_Integer nbPnts1 = Pnts1.Length();
68 Standard_Integer nbPnts2 = Pnts2.Length();
71 done = Standard_False;
76 nbMultiplicities.Clear();
85 // Chargement de etat1 et etat2 et des ustart et vstart.
87 TColStd_SequenceOfReal Umult;
88 TColStd_SequenceOfReal Vmult;
90 Standard_Integer decal=0;
91 for (I=1;I <= nbPnts1+decal; I++) {
92 PathPnt = Pnts1.Value(I-decal);
94 if (!ThePointOfPathTool::IsPassingPnt(PathPnt))
96 if (!ThePointOfPathTool::IsTangent(PathPnt))
97 etat1(I) = etat1(I) + 1;
99 Standard_Integer etat1I=etat1(I);
100 //-- cout<<" \n Etat1("<<I<<") = "<<etat1I<<endl;
101 if(etat1I==2) { //-- lbr le 15 fev 99
104 ThePointOfPathTool::Value2d(PathPnt, U,V);
107 nbMultiplicities.Append(ThePointOfPathTool::Multiplicity(PathPnt));
109 for (Standard_Integer J = 1; J <= nbMultiplicities(I); J++) {
110 ThePointOfPathTool::Parameters(PathPnt, J, U , V);
117 ThePointOfPathTool::Value2d(PathPnt, U,V);
120 nbMultiplicities.Append(ThePointOfPathTool::Multiplicity(PathPnt));
122 for (Standard_Integer J = 1; J <= nbMultiplicities(I); J++) {
123 ThePointOfPathTool::Parameters(PathPnt, J, U , V);
131 for (I = 1; I <= nbPnts2; I++) {
133 ThePointOfLoopTool::Value2d(Pnts2.Value(I), U,V);
138 tolerance(1) = ThePSurfaceTool::UResolution(Caro,Precision::Confusion());
139 tolerance(2) = ThePSurfaceTool::VResolution(Caro,Precision::Confusion());
141 Um = ThePSurfaceTool::FirstUParameter(Caro);
142 Vm = ThePSurfaceTool::FirstVParameter(Caro);
143 UM = ThePSurfaceTool::LastUParameter(Caro);
144 VM = ThePSurfaceTool::LastVParameter(Caro);
147 Standard_Real utemp = UM;
152 Standard_Real vtemp = VM;
159 // calcul de toutes les lignes ouvertes
160 if (nbPnts1 != 0) ComputeOpenLine(Umult,Vmult,Pnts1,Func,Rajout);
161 // calcul de toutes les lignes fermees
162 if (nbPnts2 != 0) ComputeCloseLine(Umult,Vmult,Pnts1,Pnts2,Func,Rajout);
163 for (I = 1; I <= nbPnts1; I++) {
164 if (etat1(I) >0) seqSingle.Append(Pnts1(I));
166 done = Standard_True;
172 // Perform sans point interieur
175 void IntWalk_IWalking::Perform(const ThePOPIterator& Pnts1,
177 const ThePSurface& Caro,
178 const Standard_Boolean Reversed)
182 ThePointOfPath PathPnt;
183 Standard_Boolean Rajout = Standard_False;
184 Standard_Integer nbPnts1 = Pnts1.Length();
187 done = Standard_False;
192 nbMultiplicities.Clear();
201 // Chargement de etat1 et de ustart1 et vstart1.
203 TColStd_SequenceOfReal Umult;
204 TColStd_SequenceOfReal Vmult;
206 for (I=1;I <= nbPnts1; I++) {
207 PathPnt = Pnts1.Value(I);
209 if (!ThePointOfPathTool::IsPassingPnt(PathPnt)) etat1(I) = 11;
210 if (!ThePointOfPathTool::IsTangent(PathPnt)) etat1(I) = etat1(I) + 1;
211 ThePointOfPathTool::Value2d(PathPnt, U,V);
214 nbMultiplicities.Append(ThePointOfPathTool::Multiplicity(PathPnt));
216 for (Standard_Integer J = 1; J <= nbMultiplicities(I); J++) {
217 ThePointOfPathTool::Parameters(PathPnt, J, U , V);
223 tolerance(1) = ThePSurfaceTool::UResolution(Caro,Precision::Confusion());
224 tolerance(2) = ThePSurfaceTool::VResolution(Caro,Precision::Confusion());
226 Um = ThePSurfaceTool::FirstUParameter(Caro);
227 Vm = ThePSurfaceTool::FirstVParameter(Caro);
228 UM = ThePSurfaceTool::LastUParameter(Caro);
229 VM = ThePSurfaceTool::LastVParameter(Caro);
232 Standard_Real utemp = UM;
237 Standard_Real vtemp = VM;
244 // calcul de toutes les lignes ouvertes
245 if (nbPnts1 != 0) ComputeOpenLine(Umult,Vmult,Pnts1,Func,Rajout);
247 for (I = 1; I <= nbPnts1; I++) {
248 if (etat1(I) >0) seqSingle.Append(Pnts1(I));
250 done = Standard_True;