0023024: Update headers of OCCT files
[occt.git] / src / TopClass / TopClass_Classifier3d.gxx
1 // Created on: 1994-03-30
2 // Created by: Laurent BUCHARD
3 // Copyright (c) 1994-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
5 //
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
10 //
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 //
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
20
21
22
23
24 //======================================================================
25 TopClass_Classifier3d::TopClass_Classifier3d() : isSet(Standard_False)
26 {
27 }
28
29 //======================================================================
30 void TopClass_Classifier3d::Reset(const gp_Lin&       L,
31                                  const Standard_Real Param,
32                                  const Standard_Real Tol) { 
33   myLin       = L;
34   myParam     = RealLast();
35   myTolerance = Tol;
36   myState     = TopAbs_UNKNOWN;
37   isSet       = Standard_True;
38 }
39 //======================================================================
40 #include <IntCurveSurface_IntersectionPoint.hxx>
41 #include <IntCurveSurface_TransitionOnCurve.hxx>
42
43 void TopClass_Classifier3d::Compare(const TopoDS_Face&        Face,
44                                     const TopAbs_Orientation  Orientation) {  
45   if(!isSet) { 
46     cout<<" Call to TopClass_Classifier3d::Compare  without a Reset ! ";
47     return;
48   }
49
50   hasIntersect = Standard_False;
51   myIntersector.Perform(myLin,myParam,myTolerance,Face);
52   if(myIntersector.IsDone()) { 
53     if(myIntersector.HasAPoint()) { 
54       hasIntersect = Standard_True;
55       if(myIntersector.WParameter() < myParam) { 
56         myParam = myIntersector.WParameter();
57         myFace  = myIntersector.Face(); 
58         if(Abs(myParam)<=myTolerance) { 
59           //-- #########################################
60           cout<<" myParam = "<<myParam<<" ds TopClass_Classifier3d.gxx  "<<endl;
61           //-- #########################################
62           myState = TopAbs_ON;
63         }
64         else { 
65           //-- The intersection point between the line and a face F of the solid 
66           //-- is in the face F or On a boundary of the face 
67           if(myIntersector.Transition() == IntCurveSurface_Out) { 
68             //-- The line is going from inside the solid to outside the solid.
69             myState = TopAbs_IN;
70           }
71           else if(myIntersector.Transition() == IntCurveSurface_In) { 
72             myState = TopAbs_OUT;
73           }
74           else { 
75             cout<<" -------- Probleme ds TopClass_Classifier3d.gxx "<<endl;
76           }
77         }
78       }
79       else { 
80         //-- No point has been found by the myIntersector.
81         //-- Or a Point has been found with a greater parameter.
82       }
83     } //-- myIntersector Has a point 
84     else { 
85       //-- The myIntersector failed.
86     } 
87   } //-- Face has not been rejected
88 }