0031172: Unexpected result of BRepTools::OuterWire()
[occt.git] / src / TopClass / TopClass_Classifier3d.gxx
CommitLineData
b311480e 1// Created on: 1994-03-30
2// Created by: Laurent BUCHARD
3// Copyright (c) 1994-1999 Matra Datavision
973c2be1 4// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5//
973c2be1 6// This file is part of Open CASCADE Technology software library.
b311480e 7//
d5f74e42 8// This library is free software; you can redistribute it and/or modify it under
9// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 10// by the Free Software Foundation, with special exception defined in the file
11// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12// distribution for complete text of the license and disclaimer of any warranty.
b311480e 13//
973c2be1 14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
7fd59977 16
17//======================================================================
d533dafb 18TopClass_Classifier3d::TopClass_Classifier3d()
19: isSet(Standard_False),
20 myParam(0.0),
21 myTolerance(0.0),
22 myState(TopAbs_UNKNOWN),
23 hasIntersect(Standard_False)
7fd59977 24{
25}
26
27//======================================================================
28void TopClass_Classifier3d::Reset(const gp_Lin& L,
498ce76b 29 const Standard_Real,
7fd59977 30 const Standard_Real Tol) {
31 myLin = L;
32 myParam = RealLast();
33 myTolerance = Tol;
34 myState = TopAbs_UNKNOWN;
35 isSet = Standard_True;
36}
37//======================================================================
38#include <IntCurveSurface_IntersectionPoint.hxx>
39#include <IntCurveSurface_TransitionOnCurve.hxx>
40
41void TopClass_Classifier3d::Compare(const TopoDS_Face& Face,
498ce76b 42 const TopAbs_Orientation) {
7fd59977 43 if(!isSet) {
0797d9d3 44#ifdef OCCT_DEBUG
04232180 45 std::cout<<" Call to TopClass_Classifier3d::Compare without a Reset ! ";
63c629aa 46#endif
7fd59977 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 //-- #########################################
0797d9d3 60#ifdef OCCT_DEBUG
04232180 61 std::cout<<" myParam = "<<myParam<<" ds TopClass_Classifier3d.gxx "<<std::endl;
63c629aa 62#endif
7fd59977 63 //-- #########################################
64 myState = TopAbs_ON;
65 }
66 else {
67 //-- The intersection point between the line and a face F of the solid
68 //-- is in the face F or On a boundary of the face
69 if(myIntersector.Transition() == IntCurveSurface_Out) {
70 //-- The line is going from inside the solid to outside the solid.
71 myState = TopAbs_IN;
72 }
73 else if(myIntersector.Transition() == IntCurveSurface_In) {
74 myState = TopAbs_OUT;
75 }
0797d9d3 76#ifdef OCCT_DEBUG
63c629aa 77 else {
04232180 78 std::cout<<" -------- Probleme ds TopClass_Classifier3d.gxx "<<std::endl;
63c629aa 79 }
80#endif
7fd59977 81 }
82 }
83 else {
84 //-- No point has been found by the myIntersector.
85 //-- Or a Point has been found with a greater parameter.
86 }
87 } //-- myIntersector Has a point
88 else {
89 //-- The myIntersector failed.
90 }
91 } //-- Face has not been rejected
92}