Integration of OCCT 6.5.0 from SVN
[occt.git] / src / TopClass / TopClass_Classifier3d.gxx
CommitLineData
7fd59977 1// File: TopClass_Classifier3d.gxx
2// Created: Wed Mar 30 09:54:56 1994
3// Author: Laurent BUCHARD
4// <lbr@fuegox>
5
6
7
8//======================================================================
9TopClass_Classifier3d::TopClass_Classifier3d() : isSet(Standard_False)
10{
11}
12
13//======================================================================
14void TopClass_Classifier3d::Reset(const gp_Lin& L,
15 const Standard_Real Param,
16 const Standard_Real Tol) {
17 myLin = L;
18 myParam = RealLast();
19 myTolerance = Tol;
20 myState = TopAbs_UNKNOWN;
21 isSet = Standard_True;
22}
23//======================================================================
24#include <IntCurveSurface_IntersectionPoint.hxx>
25#include <IntCurveSurface_TransitionOnCurve.hxx>
26
27void TopClass_Classifier3d::Compare(const TopoDS_Face& Face,
28 const TopAbs_Orientation Orientation) {
29 if(!isSet) {
30 cout<<" Call to TopClass_Classifier3d::Compare without a Reset ! ";
31 return;
32 }
33
34 hasIntersect = Standard_False;
35 myIntersector.Perform(myLin,myParam,myTolerance,Face);
36 if(myIntersector.IsDone()) {
37 if(myIntersector.HasAPoint()) {
38 hasIntersect = Standard_True;
39 if(myIntersector.WParameter() < myParam) {
40 myParam = myIntersector.WParameter();
41 myFace = myIntersector.Face();
42 if(Abs(myParam)<=myTolerance) {
43 //-- #########################################
44 cout<<" myParam = "<<myParam<<" ds TopClass_Classifier3d.gxx "<<endl;
45 //-- #########################################
46 myState = TopAbs_ON;
47 }
48 else {
49 //-- The intersection point between the line and a face F of the solid
50 //-- is in the face F or On a boundary of the face
51 if(myIntersector.Transition() == IntCurveSurface_Out) {
52 //-- The line is going from inside the solid to outside the solid.
53 myState = TopAbs_IN;
54 }
55 else if(myIntersector.Transition() == IntCurveSurface_In) {
56 myState = TopAbs_OUT;
57 }
58 else {
59 cout<<" -------- Probleme ds TopClass_Classifier3d.gxx "<<endl;
60 }
61 }
62 }
63 else {
64 //-- No point has been found by the myIntersector.
65 //-- Or a Point has been found with a greater parameter.
66 }
67 } //-- myIntersector Has a point
68 else {
69 //-- The myIntersector failed.
70 }
71 } //-- Face has not been rejected
72}