]> SALOME platform Git repositories - modules/geom.git/blob - src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.cxx
Salome HOME
Improve CheckShape function
[modules/geom.git] / src / GEOMAlgo / GEOMAlgo_FinderShapeOn1.cxx
1 // File:        GEOMAlgo_FinderShapeOn1.cxx
2 // Created:     Fri Mar  4 10:31:06 2005
3 // Author:      Peter KURNEV
4 //              <pkv@irinox>
5
6
7 #include <GEOMAlgo_FinderShapeOn1.ixx>
8 #include <math.h>
9
10
11 #include <Precision.hxx>
12 #include <TColStd_Array1OfInteger.hxx>
13 #include <TColStd_MapOfInteger.hxx>
14
15 #include <gp_Trsf.hxx>
16 #include <gp_Cylinder.hxx>
17 #include <gp_Pnt.hxx>
18
19 #include <TColgp_Array1OfPnt.hxx>
20
21 #include <Poly_Array1OfTriangle.hxx>
22 #include <Poly_Triangle.hxx>
23 #include <Poly_PolygonOnTriangulation.hxx>
24 #include <Poly_Triangulation.hxx>
25
26 #include <Geom_Curve.hxx>
27 #include <Geom_Surface.hxx>
28 #include <GeomAdaptor_Surface.hxx>
29 #include <GeomAbs_SurfaceType.hxx>
30 #include <GeomAdaptor_Curve.hxx>
31 #include <GeomAbs_CurveType.hxx>
32
33 #include <TopAbs_State.hxx>
34
35 #include <TopLoc_Location.hxx>
36 #include <TopoDS.hxx>
37 #include <TopoDS_Shape.hxx>
38 #include <TopoDS_Vertex.hxx>
39 #include <TopoDS_Face.hxx>
40 #include <TopoDS_Edge.hxx>
41
42 #include <TopExp.hxx>
43 #include <TopExp_Explorer.hxx>
44
45 #include <TopTools_IndexedMapOfShape.hxx>
46
47 #include <BRep_Tool.hxx>
48 #include <BRepLib_MakeEdge.hxx>
49
50 #include <GEOMAlgo_ListIteratorOfListOfPnt.hxx>
51 #include <GEOMAlgo_PassKey.hxx>
52 #include <GEOMAlgo_DataMapOfPassKeyInteger.hxx>
53 #include <GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger.hxx>
54 #include <GEOMAlgo_SurfaceTools.hxx>
55 #include <GEOMAlgo_StateCollector.hxx>
56
57
58 //=======================================================================
59 //function : GEOMAlgo_FinderShapeOn1
60 //purpose  : 
61 //=======================================================================
62 GEOMAlgo_FinderShapeOn1::GEOMAlgo_FinderShapeOn1()
63 :
64   GEOMAlgo_ShapeAlgo()
65 {
66   myTolerance=0.0001;
67   myShapeType=TopAbs_VERTEX;
68   myState=GEOMAlgo_ST_UNKNOWN;
69   myNbPntsMin=3;
70   myNbPntsMax=0;
71 }
72 //=======================================================================
73 //function : ~
74 //purpose  : 
75 //=======================================================================
76 GEOMAlgo_FinderShapeOn1::~GEOMAlgo_FinderShapeOn1()
77 {
78 }
79 //=======================================================================
80 //function : SetSurface
81 //purpose  : 
82 //=======================================================================
83 void GEOMAlgo_FinderShapeOn1::SetSurface(const Handle(Geom_Surface)& aS)
84 {
85   mySurface=aS;
86 }
87 //=======================================================================
88 //function : Surface
89 //purpose  : 
90 //=======================================================================
91 const Handle(Geom_Surface)& GEOMAlgo_FinderShapeOn1::Surface() const
92 {
93   return mySurface;
94 }
95 //=======================================================================
96 //function : SetShapeType
97 //purpose  : 
98 //=======================================================================
99 void GEOMAlgo_FinderShapeOn1::SetShapeType(const TopAbs_ShapeEnum aType)
100 {
101   myShapeType=aType;
102 }
103 //=======================================================================
104 //function : ShapeType
105 //purpose  : 
106 //=======================================================================
107 TopAbs_ShapeEnum GEOMAlgo_FinderShapeOn1::ShapeType()const
108 {
109   return myShapeType;
110 }
111 //=======================================================================
112 //function : SetState
113 //purpose  : 
114 //=======================================================================
115 void GEOMAlgo_FinderShapeOn1::SetState(const GEOMAlgo_State aState)
116 {
117   myState=aState;
118 }
119 //=======================================================================
120 //function : State
121 //purpose  : 
122 //=======================================================================
123 GEOMAlgo_State GEOMAlgo_FinderShapeOn1::State() const
124 {
125   return myState;
126 }
127 //=======================================================================
128 //function : SetNbPntsMin
129 //purpose  : 
130 //=======================================================================
131 void GEOMAlgo_FinderShapeOn1::SetNbPntsMin(const Standard_Integer aNb)
132 {
133   myNbPntsMin=aNb;
134 }
135 //=======================================================================
136 //function : NbPntsMin
137 //purpose  : 
138 //=======================================================================
139 Standard_Integer GEOMAlgo_FinderShapeOn1::NbPntsMin()const
140 {
141   return myNbPntsMin;
142 }
143 //=======================================================================
144 //function : SetNbPntsMax
145 //purpose  : 
146 //=======================================================================
147 void GEOMAlgo_FinderShapeOn1::SetNbPntsMax(const Standard_Integer aNb)
148 {
149   myNbPntsMax=aNb;
150 }
151 //=======================================================================
152 //function : NbPntsMax
153 //purpose  : 
154 //=======================================================================
155 Standard_Integer GEOMAlgo_FinderShapeOn1::NbPntsMax()const
156 {
157   return myNbPntsMax;
158 }
159 //=======================================================================
160 // function: MSS
161 // purpose: 
162 //=======================================================================
163 const GEOMAlgo_IndexedDataMapOfShapeState& GEOMAlgo_FinderShapeOn1::MSS() const
164 {
165   return myMSS;
166 }
167 //=======================================================================
168 // function: Shapes
169 // purpose: 
170 //=======================================================================
171 const TopTools_ListOfShape& GEOMAlgo_FinderShapeOn1::Shapes() const
172 {
173   Standard_Integer i, aNb;
174   TopTools_ListOfShape* pL;
175   //
176   pL=(TopTools_ListOfShape*) &myLS;
177   pL->Clear();
178   //
179   aNb=myMSS.Extent();
180   for (i=1; i<=aNb; ++i) {
181     const TopoDS_Shape& aS=myMSS.FindKey(i);
182     if (aS.ShapeType()==myShapeType) {
183       pL->Append(aS);
184     }
185   }
186   return myLS;
187 }
188 //=======================================================================
189 //function : Perform
190 //purpose  : 
191 //=======================================================================
192 void GEOMAlgo_FinderShapeOn1::Perform()
193 {
194   myErrorStatus=0;
195   myWarningStatus=0;
196   myLS.Clear();
197   myMSS.Clear();
198   //
199   CheckData();
200   if(myErrorStatus) {
201     return;
202   }
203   //
204   // 1
205   ProcessVertices();
206   if(myErrorStatus) {
207     return;
208   }
209   if (myShapeType==TopAbs_VERTEX) {
210     return;
211   }
212   //
213   // 2
214   ProcessEdges();
215   if(myErrorStatus) {
216     return;
217   }
218   if (myShapeType==TopAbs_EDGE) {
219     return;
220   }
221   //
222   // 3
223   ProcessFaces();
224   if(myErrorStatus) {
225     return;
226   }
227   if (myShapeType==TopAbs_FACE) {
228     return;
229   }
230   //
231   // 4
232   ProcessSolids(); 
233   //
234 }
235 //=======================================================================
236 //function : ProcessVertices
237 //purpose  : 
238 //=======================================================================
239 void GEOMAlgo_FinderShapeOn1::ProcessVertices()
240 {
241   myErrorStatus=0;
242   //
243   Standard_Boolean bIsConformState;
244   Standard_Integer i, aNb;
245   gp_Pnt aP;
246   TopTools_IndexedMapOfShape aM;
247   TopAbs_State aSt;
248   //
249   TopExp::MapShapes(myShape, TopAbs_VERTEX, aM);
250   aNb=aM.Extent();
251   for (i=1; i<=aNb; ++i) {
252     const TopoDS_Vertex& aV=TopoDS::Vertex(aM(i));
253     aP=BRep_Tool::Pnt(aV);
254     //
255     GEOMAlgo_SurfaceTools::GetState(aP, myGAS, myTolerance, aSt);
256     bIsConformState=GEOMAlgo_SurfaceTools::IsConformState(aSt, myState);
257     //
258     if (myShapeType==TopAbs_VERTEX){
259       if (bIsConformState) {
260         myMSS.Add(aV, aSt);
261       }
262     }
263     else if (bIsConformState || aSt==TopAbs_ON) {
264       myMSS.Add(aV, aSt);
265     }
266   }
267 }
268 //=======================================================================
269 //function : ProcessEdges
270 //purpose  : 
271 //=======================================================================
272 void GEOMAlgo_FinderShapeOn1::ProcessEdges()
273 {
274   myErrorStatus=0;
275   //
276   Standard_Boolean bIsConformState, bIsToBreak;
277   Standard_Integer i, aNb, iCnt;
278   TopAbs_State aSt;
279   TopTools_IndexedMapOfShape aM;
280   TopExp_Explorer aExp;
281   GEOMAlgo_ListIteratorOfListOfPnt aIt;
282   GeomAbs_SurfaceType aType1;
283   //
284   aType1=myGAS.GetType();
285   //
286   TopExp::MapShapes(myShape, TopAbs_EDGE, aM);
287   aNb=aM.Extent();
288   for (i=1; i<=aNb; ++i) {
289     GEOMAlgo_ListOfPnt aLP;
290     GEOMAlgo_StateCollector aSC;
291     //
292     const TopoDS_Edge& aE=TopoDS::Edge(aM(i));
293     //
294     aExp.Init(aE, TopAbs_VERTEX);
295     for (; aExp.More(); aExp.Next()) {
296       const TopoDS_Shape& aV=aExp.Current();
297       //
298       bIsConformState=myMSS.Contains(aV);
299       if (!bIsConformState) {
300         break;// vertex has non-conformed state
301       }
302       else {
303         aSt=myMSS.FindFromKey(aV);
304         aSC.AppendState(aSt);
305       }
306     }
307     //
308     if (!bIsConformState) {
309       continue; // vertex has non-conformed state,skip edge
310     }
311     //
312     if (BRep_Tool::Degenerated(aE)) {
313       myMSS.Add(aE, aSt); 
314       continue;
315     }
316     //
317     if (myState==GEOMAlgo_ST_ON && aType1==GeomAbs_Sphere) {
318       Standard_Real aT1, aT2;
319       Handle(Geom_Curve) aC; 
320       GeomAdaptor_Curve aGAC;
321       GeomAbs_CurveType aType2;
322       //
323       aC=BRep_Tool::Curve(aE, aT1, aT2);
324       aGAC.Load(aC);
325       //
326       aType2=aGAC.GetType();
327       if (aType2==GeomAbs_Line) {
328         continue;
329       }
330     }
331     //
332     InnerPoints(aE, aLP);
333     if (myErrorStatus) {
334       return;  
335     }
336     //
337     bIsConformState=Standard_True;
338     aIt.Initialize(aLP);
339     for (iCnt=0; aIt.More(); aIt.Next(), ++iCnt) {
340       if (myNbPntsMax) {
341         if (iCnt > myNbPntsMax) {
342           break;
343         }
344       }
345       //
346       const gp_Pnt& aP=aIt.Value();
347       GEOMAlgo_SurfaceTools::GetState(aP, myGAS, myTolerance, aSt);
348       bIsToBreak=aSC.AppendState(aSt);
349       if (bIsToBreak) {
350         break;
351       }
352     }
353     //
354     aSt=aSC.State();    
355     //
356     bIsConformState=GEOMAlgo_SurfaceTools::IsConformState(aSt, myState);
357     if (myShapeType==TopAbs_EDGE) {
358       if (bIsConformState) {
359         myMSS.Add(aE, aSt);
360       }
361     }
362     else if (bIsConformState || aSt==TopAbs_ON) {
363       myMSS.Add(aE, aSt);
364     }
365   } //  for (i=1; i<=aNb; ++i) next edge 
366 }
367 //=======================================================================
368 //function : ProcessFaces
369 //purpose  : 
370 //=======================================================================
371 void GEOMAlgo_FinderShapeOn1::ProcessFaces()
372 {
373   myErrorStatus=0;
374   //
375   Standard_Boolean bIsConformState, bIsToBreak;
376   Standard_Integer i, aNbF, iCnt;
377   TopAbs_State aSt;
378   TopTools_IndexedMapOfShape aM;
379   TopExp_Explorer aExp;
380   GEOMAlgo_ListIteratorOfListOfPnt aIt;
381   GeomAbs_SurfaceType aType1, aType2;
382   //
383   aType1=myGAS.GetType();
384   //
385   TopExp::MapShapes(myShape, TopAbs_FACE, aM);
386   aNbF=aM.Extent();
387   for (i=1; i<=aNbF; ++i) {
388     GEOMAlgo_StateCollector aSC;
389     GEOMAlgo_ListOfPnt aLP;
390     //
391     const TopoDS_Face& aF=TopoDS::Face(aM(i));
392     //
393     if (myState==GEOMAlgo_ST_ON) {
394       Handle(Geom_Surface) aS;
395       GeomAdaptor_Surface aGAS;
396       //
397       aS=BRep_Tool::Surface(aF);
398       aGAS.Load(aS);
399       aType2=aGAS.GetType();
400       if (aType2!=aType1) {
401         continue;
402       }
403     }
404     //
405     aExp.Init(aF, TopAbs_EDGE);
406     for (; aExp.More(); aExp.Next()) {
407       const TopoDS_Shape& aE=aExp.Current();
408       bIsConformState=myMSS.Contains(aE);
409       if (!bIsConformState) {
410         break;// edge has non-conformed state
411       }
412       else {
413         aSt=myMSS.FindFromKey(aE);
414         aSC.AppendState(aSt);
415       }
416     }
417     //
418     if (!bIsConformState) {
419       continue; // edge has non-conformed state,skip face
420     }
421     //
422     InnerPoints(aF, aLP);
423     if (myErrorStatus) {
424       return;
425     }
426     //
427     bIsConformState=Standard_True;
428     aIt.Initialize(aLP);
429     for (iCnt=0; aIt.More(); aIt.Next(), ++iCnt) {
430       if (myNbPntsMax) {
431         if (iCnt > myNbPntsMax) {
432           break;
433         }
434       }
435       //
436       const gp_Pnt& aP=aIt.Value();
437       GEOMAlgo_SurfaceTools::GetState(aP, myGAS, myTolerance, aSt);
438       bIsToBreak=aSC.AppendState(aSt);
439       if (bIsToBreak) {
440         break;
441       }
442     }
443     //
444     aSt=aSC.State();    
445     //
446     bIsConformState=GEOMAlgo_SurfaceTools::IsConformState(aSt, myState);
447     if (myShapeType==TopAbs_FACE) {
448       if (bIsConformState) {
449         myMSS.Add(aF, aSt);
450       }
451     }
452     else if (bIsConformState || aSt==TopAbs_ON) {
453       myMSS.Add(aF, aSt);
454     }
455   }//  for (i=1; i<=aNb; ++i) next face 
456 }
457 //=======================================================================
458 //function : ProcessSolids
459 //purpose  : 
460 //=======================================================================
461 void GEOMAlgo_FinderShapeOn1::ProcessSolids()
462 {
463   myErrorStatus=0;
464   //
465   Standard_Boolean bIsConformState;
466   Standard_Integer i, aNbS, j, aNbF;
467   TopTools_IndexedMapOfShape aM, aMF;
468   TopAbs_State aSt;
469   //
470   TopExp::MapShapes(myShape, TopAbs_SOLID, aM);
471   aNbS=aM.Extent();
472   for (i=1; i<=aNbS; ++i) {
473     GEOMAlgo_StateCollector aSC;
474     //
475     const TopoDS_Shape& aSd=aM(i);
476     aMF.Clear();
477     TopExp::MapShapes(aSd, TopAbs_FACE, aMF);
478     aNbF=aMF.Extent();
479     for (j=1; j<=aNbF; ++j) {
480       const TopoDS_Shape& aF=aMF(j);
481       bIsConformState=myMSS.Contains(aF);
482       if (!bIsConformState) {
483         break;// face has non-conformed state
484       }
485       else {
486         aSt=myMSS.FindFromKey(aF);
487         aSC.AppendState(aSt);
488       }
489     }
490     //
491     if (!bIsConformState) {
492       continue; // face has non-conformed state,skip solid
493     }
494     //
495     aSt=aSC.State();    
496     //
497     bIsConformState=GEOMAlgo_SurfaceTools::IsConformState(aSt, myState);
498     if (bIsConformState) {
499       myMSS.Add(aSd, aSt);
500     }
501   }
502 }
503 //
504 //=======================================================================
505 //function : InnerPoints
506 //purpose  : 
507 //=======================================================================
508 void GEOMAlgo_FinderShapeOn1::InnerPoints(const TopoDS_Face& aF,
509                                           GEOMAlgo_ListOfPnt& aLP)
510 {
511   myErrorStatus=0;
512   //
513   Standard_Integer j, j1, j2, k, n[4], aNbLinks, aNx, aNbMax, aNb;
514   Standard_Integer iCnt, *pIds;
515   TopLoc_Location aLoc;
516   Handle(Poly_Triangulation) aTRF;
517   TColStd_MapOfInteger aMBN;
518   GEOMAlgo_DataMapOfPassKeyInteger aMPKI;
519   GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger aIt;
520   gp_Pnt aP, aP1, aP2;
521   //
522   aLP.Clear();
523   //
524   aTRF=BRep_Tool::Triangulation(aF, aLoc);
525   if (aTRF.IsNull()) {
526     myErrorStatus=20; // no triangulation found
527     return;  
528   }
529   //
530   const gp_Trsf& aTrsf=aLoc.Transformation();
531   const Poly_Array1OfTriangle& aTrs=aTRF->Triangles();
532   const TColgp_Array1OfPnt& aNodes=aTRF->Nodes();
533   //
534   // map link/nbtriangles
535   j1=aTrs.Lower();
536   j2=aTrs.Upper();
537   for (j=j1; j<=j2; ++j) {
538     const Poly_Triangle& aTr=aTrs(j);
539     aTr.Get(n[0], n[1], n[2]);
540     n[3]=n[0];
541     for (k=0; k<3; ++k) {
542       GEOMAlgo_PassKey aPK;
543       //
544       aPK.SetIds(n[k], n[k+1]);
545       if (aMPKI.IsBound(aPK)) {
546         Standard_Integer& iCntX=aMPKI.ChangeFind(aPK);
547         ++iCntX;
548       }
549       else {
550         aMPKI.Bind(aPK, 1);
551       }
552     }
553   }
554   //
555   // boundary nodes aMBN
556   aNbLinks=aMPKI.Extent();
557   aIt.Initialize(aMPKI);
558   for (; aIt.More(); aIt.Next()) {
559     iCnt=aIt.Value();
560     if (iCnt==1) {
561       const GEOMAlgo_PassKey& aPK=aIt.Key();
562       aNbMax=aPK.NbMax();
563       pIds=(Standard_Integer*)aPK.Key();
564       for (k=1; k<3; ++k) {
565         aNx=*(pIds+aNbMax-k);
566         aMBN.Add(aNx);
567       }
568     }
569   }
570   //
571   // inner nodes=all_nodes - boundary_nodes 
572   j1=aNodes.Lower();
573   j2=aNodes.Upper();
574   for (j=j1; j<=j2; ++j) {
575     if (!aMBN.Contains(j)) {
576       aP=aNodes(j).Transformed(aTrsf);
577       aLP.Append(aP);
578     }
579   }
580   //
581   aNb=aLP.Extent();
582   //
583   if (!aNb && myNbPntsMin) { 
584     // try to fill it yourself
585     Standard_Boolean bIsDone;
586     Standard_Integer aN1, aN2;
587     Handle(Geom_Surface) aS;
588     GeomAdaptor_Surface aGAS;
589     GeomAbs_SurfaceType aType;
590     //
591     aS=BRep_Tool::Surface(aF);
592     aGAS.Load(aS);
593     aType=aGAS.GetType();
594     if (aType==GeomAbs_Plane || aType==GeomAbs_Cylinder) {
595       // inner links
596       aNbLinks=aMPKI.Extent();
597       aIt.Initialize(aMPKI);
598       for (; aIt.More(); aIt.Next()) {
599         iCnt=aIt.Value();
600         if (iCnt>1) {
601           // take the first having occured inner link
602           // and discretize it
603           const GEOMAlgo_PassKey& aPK=aIt.Key();
604           aNbMax=aPK.NbMax();
605           pIds=(Standard_Integer*)aPK.Key();
606           aN1=*(pIds+aNbMax-1);
607           aN2=*(pIds+aNbMax-2);
608           aP1=aNodes(aN1).Transformed(aTrsf);
609           aP2=aNodes(aN2).Transformed(aTrsf);
610           //
611           if (aType==GeomAbs_Cylinder) {
612             Standard_Real aTolSM;
613             gp_Cylinder aCyl;
614             //
615             aTolSM=1.523e-6;//~1.-cos(0.1 deg)
616             aCyl=aGAS.Cylinder();
617             if (!GEOMAlgo_SurfaceTools::IsCoaxial(aP1, aP2, aCyl, aTolSM)) {
618               continue;
619             }
620           }
621           //
622           BRepLib_MakeEdge aBME(aP1, aP2);
623           bIsDone=aBME.IsDone();
624           if (!bIsDone) {
625             myErrorStatus=30; //can not obtain the line fron the link
626             return;
627           }
628           //
629           const TopoDS_Shape& aSx=aBME.Shape();
630           const TopoDS_Edge& aE=TopoDS::Edge(aSx);
631           //
632           InnerPoints(aE, myNbPntsMin, aLP);
633           break;
634         }// if (iCnt>1)
635       }// for (; aIt.More(); aIt.Next())
636     }// if (aType==GeomAbs_Plane || aType==GeomAbs_Cylinder) 
637   }// if (!aNb && myNbPntsMin) { 
638 }
639 //=======================================================================
640 //function : InnerPoints
641 //purpose  : 
642 //=======================================================================
643 void GEOMAlgo_FinderShapeOn1::InnerPoints(const TopoDS_Edge& aE,
644                                           GEOMAlgo_ListOfPnt& aLP)
645 {
646   myErrorStatus=0;
647   //
648   Standard_Integer j, aNbNodes, aIndex, aNb;
649   Handle(Poly_PolygonOnTriangulation) aPTE;
650   Handle(Poly_Triangulation) aTRE;
651   TopLoc_Location aLoc;
652   gp_Pnt aP;
653   //
654   aLP.Clear();
655   BRep_Tool::PolygonOnTriangulation(aE, aPTE, aTRE, aLoc);
656   if (aTRE.IsNull() || aPTE.IsNull()) {
657     myErrorStatus=20; // no triangulation found
658     return;  
659   }
660   //
661   const gp_Trsf& aTrsf=aLoc.Transformation();
662   const TColgp_Array1OfPnt& aNodes=aTRE->Nodes();
663   //
664   aNbNodes=aPTE->NbNodes();
665   const TColStd_Array1OfInteger& aInds=aPTE->Nodes();
666   for (j=2; j<aNbNodes; ++j) {
667     aIndex=aInds(j);
668     aP=aNodes(aIndex).Transformed(aTrsf);
669     aLP.Append(aP);
670   }
671   //
672   aNb=aLP.Extent();
673   if (!aNb && myNbPntsMin) { 
674     // try to fill it yourself
675     InnerPoints(aE, myNbPntsMin, aLP);
676     aNb=aLP.Extent();
677     
678   }
679 }
680 //=======================================================================
681 //function : InnerPoints
682 //purpose  : 
683 //=======================================================================
684 void GEOMAlgo_FinderShapeOn1::InnerPoints(const TopoDS_Edge& aE,
685                                           const Standard_Integer aNbPntsMin,
686                                           GEOMAlgo_ListOfPnt& aLP)
687 {
688   // try to fill it yourself
689   Standard_Boolean bInf1, bInf2;
690   Standard_Integer j, aNbT;
691   Standard_Real dT, aT, aT1, aT2;
692   gp_Pnt aP;
693   Handle(Geom_Curve) aC3D;
694   //
695   aC3D=BRep_Tool::Curve(aE, aT1, aT2);
696   if (aC3D.IsNull()) {
697     return;
698   }
699   //
700   bInf1=Precision::IsNegativeInfinite(aT1);
701   bInf2=Precision::IsPositiveInfinite(aT2);
702   if (bInf1 || bInf2) {
703     return;
704   }
705   //
706   aNbT=myNbPntsMin+1;
707   dT=(aT2-aT1)/aNbT;
708   for (j=1; j<=aNbPntsMin; ++j) {
709     aT=aT1+j*dT;
710     aC3D->D0(aT, aP);
711     aLP.Append(aP);
712   }
713 }
714
715 //=======================================================================
716 //function : CheckData
717 //purpose  : 
718 //=======================================================================
719 void GEOMAlgo_FinderShapeOn1::CheckData()
720 {
721   myErrorStatus=0;
722   //
723   if(mySurface.IsNull()) {
724     myErrorStatus=10; // mySurface=NULL
725     return;
726   }
727   //
728   if (myShape.IsNull()) {
729     myErrorStatus=11; // myShape=NULL
730     return;
731   }
732   //
733   if (!(myShapeType==TopAbs_VERTEX ||
734         myShapeType==TopAbs_EDGE ||
735         myShapeType==TopAbs_FACE ||
736         myShapeType==TopAbs_SOLID)) {
737     myErrorStatus=12; // unallowed subshape type
738     return;
739   }
740   //
741   if (myState==GEOMAlgo_ST_UNKNOWN || 
742       myState==GEOMAlgo_ST_INOUT) {
743     myErrorStatus=13; // unallowed state type
744     return;
745   }
746   //
747   GeomAbs_SurfaceType aType;
748   //
749   myGAS.Load(mySurface);
750   aType=myGAS.GetType();
751   if (!(aType==GeomAbs_Plane || 
752         aType==GeomAbs_Cylinder ||
753         aType==GeomAbs_Sphere)) {
754     myErrorStatus=14; // unallowed surface type
755   }
756 }
757
758 //
759 // myErrorStatus :
760 //
761 // 10 -mySurface=NULL
762 // 11 -myShape=NULL
763 // 12 -unallowed type of subshapes 
764 // 13 -unallowed state  
765 // 14 -unallowed surface type
766 // 15 -unallowed surface type
767 // 20- no triangulation found
768 // 30- can not obtain the line from the link
769
770
771 /*
772 // Chronometer
773 #include <OSD_Chronometer.hxx>
774 #include <Standard_Static.hxx>
775
776 Standard_STATIC(OSD_Chronometer, x_S_Chrono);
777 static void x_StartChrono();
778 static void x_StopChrono(); 
779 static Standard_Boolean x_IsToShow(); 
780 //
781 //=======================================================================
782 //function : x_StartChrono
783 //purpose  : 
784 //=======================================================================
785 void x_StartChrono() 
786 {
787   if (x_IsToShow()){
788     x_S_Chrono().Reset();
789     x_S_Chrono().Start();
790   }
791 }
792 //=======================================================================
793 //function : x_StopChrono
794 //purpose  : 
795 //=======================================================================
796 void x_StopChrono() 
797
798   if (x_IsToShow()){
799     Standard_Real Chrono;
800     x_S_Chrono().Stop();
801     x_S_Chrono().Show(Chrono);
802     printf(" Tps: %lf\n", Chrono);
803     //cout << "Tps: " << Chrono << endl;
804   }
805 }
806 //=======================================================================
807 //function : x_IsToShow
808 //purpose  : 
809 //=======================================================================
810 Standard_Boolean x_IsToShow() 
811
812   Standard_Boolean bFlag=Standard_False;
813   //
814   char *xr=getenv ("STDCHRONO");
815   if (xr!=NULL){
816     if (!strcmp (xr, "yes")) {
817       bFlag=!bFlag;
818     }
819   }
820   return bFlag;
821 }
822 */