// Copyright (c) 1995-1999 Matra Datavision // Copyright (c) 1999-2014 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // // This library is free software; you can redistribute it and/or modify it under // the terms of the GNU Lesser General Public License version 2.1 as published // by the Free Software Foundation, with special exception defined in the file // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT // distribution for complete text of the license and disclaimer of any warranty. // // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. //-- TopClass_SolidClassifier.gxx #ifdef OCCT_DEBUG Standard_EXPORT Standard_Boolean TopClass_GettraceFC(); #endif #include //extern void DrawSegment(const gp_Pnt& P1,const gp_Lin& L,const Standard_Real par); //extern Standard_Boolean DebugDrawSegment; TopClass_SolidClassifier::TopClass_SolidClassifier() { } TopClass_SolidClassifier::TopClass_SolidClassifier(TheSolidExplorer& S, const gp_Pnt& P, const Standard_Real Tol) { Perform(S,P,Tol); } void TopClass_SolidClassifier::Perform(TheSolidExplorer& SolidExplorer, const gp_Pnt& P, const Standard_Real Tol) { #ifdef OCCT_DEBUG Standard_Boolean trace = TopClass_GettraceFC(); #endif myState = 0; if(SolidExplorer.Reject(P) == Standard_False) { //-- There is no rejection between the Shape loaded in the SolidExplorer //-- and the point P. gp_Lin L; Standard_Real Par; //-- We compute the intersection betwwen the line builded in the Solid Explorer //-- and the shape. SolidExplorer.Segment(P,L,Par); TheIntersection3d Intersector; Standard_Real parmin = RealLast(); for(SolidExplorer.InitShell(); SolidExplorer.MoreShell(); SolidExplorer.NextShell()) { if(SolidExplorer.RejectShell(L) == Standard_False) { for(SolidExplorer.InitFace(); SolidExplorer.MoreFace(); SolidExplorer.NextFace()) { if(SolidExplorer.RejectFace(L) == Standard_False) { Intersector.Perform(L,Par,Tol,SolidExplorer.CurrentFace()); if(Intersector.IsDone()) { if(Intersector.HasAPoint()) { if(Intersector.WParameter() < parmin) { parmin = Intersector.WParameter(); if(Abs(parmin)<=Tol) { #ifdef OCCT_DEBUG if (trace) { //-- ######################################### std::cout<<" parmin = "<