Warning, /include/opencascade/TopClass_Classifier3d.gxx is written in an unsupported language. File is not indexed.
0001 // Created on: 1994-03-30
0002 // Created by: Laurent BUCHARD
0003 // Copyright (c) 1994-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016
0017 //======================================================================
0018 TopClass_Classifier3d::TopClass_Classifier3d()
0019 : isSet(Standard_False),
0020 myParam(0.0),
0021 myTolerance(0.0),
0022 myState(TopAbs_UNKNOWN),
0023 hasIntersect(Standard_False)
0024 {
0025 }
0026
0027 //======================================================================
0028 void TopClass_Classifier3d::Reset(const gp_Lin& L,
0029 const Standard_Real,
0030 const Standard_Real Tol) {
0031 myLin = L;
0032 myParam = RealLast();
0033 myTolerance = Tol;
0034 myState = TopAbs_UNKNOWN;
0035 isSet = Standard_True;
0036 }
0037 //======================================================================
0038 #include <IntCurveSurface_IntersectionPoint.hxx>
0039 #include <IntCurveSurface_TransitionOnCurve.hxx>
0040
0041 void TopClass_Classifier3d::Compare(const TopoDS_Face& Face,
0042 const TopAbs_Orientation) {
0043 if(!isSet) {
0044 #ifdef OCCT_DEBUG
0045 std::cout<<" Call to TopClass_Classifier3d::Compare without a Reset ! ";
0046 #endif
0047 return;
0048 }
0049
0050 hasIntersect = Standard_False;
0051 myIntersector.Perform(myLin,myParam,myTolerance,Face);
0052 if(myIntersector.IsDone()) {
0053 if(myIntersector.HasAPoint()) {
0054 hasIntersect = Standard_True;
0055 if(myIntersector.WParameter() < myParam) {
0056 myParam = myIntersector.WParameter();
0057 myFace = myIntersector.Face();
0058 if(Abs(myParam)<=myTolerance) {
0059 //-- #########################################
0060 #ifdef OCCT_DEBUG
0061 std::cout<<" myParam = "<<myParam<<" ds TopClass_Classifier3d.gxx "<<std::endl;
0062 #endif
0063 //-- #########################################
0064 myState = TopAbs_ON;
0065 }
0066 else {
0067 //-- The intersection point between the line and a face F of the solid
0068 //-- is in the face F or On a boundary of the face
0069 if(myIntersector.Transition() == IntCurveSurface_Out) {
0070 //-- The line is going from inside the solid to outside the solid.
0071 myState = TopAbs_IN;
0072 }
0073 else if(myIntersector.Transition() == IntCurveSurface_In) {
0074 myState = TopAbs_OUT;
0075 }
0076 #ifdef OCCT_DEBUG
0077 else {
0078 std::cout<<" -------- Probleme ds TopClass_Classifier3d.gxx "<<std::endl;
0079 }
0080 #endif
0081 }
0082 }
0083 else {
0084 //-- No point has been found by the myIntersector.
0085 //-- Or a Point has been found with a greater parameter.
0086 }
0087 } //-- myIntersector Has a point
0088 else {
0089 //-- The myIntersector failed.
0090 }
0091 } //-- Face has not been rejected
0092 }