From: pkv Date: Fri, 6 Jul 2012 09:52:43 +0000 (+0400) Subject: 0023248: Wrong result done by solid classifier algorithm for infinite point X-Git-Tag: V6_5_4_beta1~139 X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=commitdiff_plain;h=a15d6aceb6e956eb19ab7c7f6d3d4f0175b5d8fa 0023248: Wrong result done by solid classifier algorithm for infinite point --- diff --git a/src/BRepTest/BRepTest_OtherCommands.cxx b/src/BRepTest/BRepTest_OtherCommands.cxx index 04114ce32a..0664d751bc 100755 --- a/src/BRepTest/BRepTest_OtherCommands.cxx +++ b/src/BRepTest/BRepTest_OtherCommands.cxx @@ -23,7 +23,32 @@ #include #include -#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include +#include + +#include + +#include +#include + +#include #include #include #include @@ -33,29 +58,82 @@ #include #include #include -#include - -#include -#include -#include +#include -#include +#include +#include -#include #include + +#include +#include #include -#include +#include +#include +#include +#include -//#ifdef WNT -#include -//#endif +#include +#include +#include +#include +#include + +static + void SampleEdges (const TopoDS_Shape& theShape, + TColgp_SequenceOfPnt& theSeq); +static + TopoDS_Face NextFaceForPrism (const TopoDS_Shape& shape, + const TopoDS_Shape& basis, + const gp_Ax1& ax1); +static + void PrintState (Draw_Interpretor& aDI, + const TopAbs_State& aState); +// +static Standard_Integer emptyshape(Draw_Interpretor&, Standard_Integer, const char** ); +static Standard_Integer subshape (Draw_Interpretor&, Standard_Integer, const char** ); +static Standard_Integer brepintcs (Draw_Interpretor&, Standard_Integer, const char** ); +static Standard_Integer MakeBoss (Draw_Interpretor&, Standard_Integer, const char** ); +static Standard_Integer MakeShell (Draw_Interpretor&, Standard_Integer, const char** ); +static Standard_Integer xbounds (Draw_Interpretor&, Standard_Integer, const char** ); +static Standard_Integer xclassify (Draw_Interpretor&, Standard_Integer, const char** ); //======================================================================= -// shape : shape name V/E/W/F/SH/SO/CS/C +//function : OtherCommands +//purpose : //======================================================================= +void BRepTest::OtherCommands(Draw_Interpretor& theCommands) +{ + static Standard_Boolean done = Standard_False; + if (done) return; + done = Standard_True; + + const char* g = "TOPOLOGY other commands"; + + theCommands.Add("shape", + "shape name V/E/W/F/Sh/So/CS/C; make a empty shape",__FILE__,emptyshape,g); -static Standard_Integer emptyshape(Draw_Interpretor& , Standard_Integer n, const char** a) + theCommands.Add("subshape", + "subshape name V/E/W/F/Sh/So/CS/C index; get subsshape of given type" + ,__FILE__,subshape,g); + + theCommands.Add("BRepIntCS", + "Calcul d'intersection entre face et curve : BRepIntCS curve shape" + ,__FILE__,brepintcs,g); + + theCommands.Add("makeboss", "create a boss on the shape myS", __FILE__, MakeBoss, g); + theCommands.Add("mksh", "create a shell on Shape", __FILE__, MakeShell, g); + theCommands.Add("xbounds", "xbounds face", __FILE__, xbounds, g); + theCommands.Add("xclassify", "use xclassify Solid [Tolerance=1.e-7]", __FILE__, xclassify, g); + + +} +//======================================================================= +//function : emptyshape +//purpose : shape : shape name V/E/W/F/SH/SO/CS/C +//======================================================================= +Standard_Integer emptyshape(Draw_Interpretor& , Standard_Integer n, const char** a) { if (n <= 1) return 1; @@ -101,10 +179,10 @@ static Standard_Integer emptyshape(Draw_Interpretor& , Standard_Integer n, const } //======================================================================= -// subshape +//function : subshape +//purpose : //======================================================================= - -static Standard_Integer subshape(Draw_Interpretor& di, Standard_Integer n, const char** a) +Standard_Integer subshape(Draw_Interpretor& di, Standard_Integer n, const char** a) { if (n <= 2) return 1; @@ -195,12 +273,11 @@ static Standard_Integer subshape(Draw_Interpretor& di, Standard_Integer n, const } return 0; } - //======================================================================= -// subshape +//function : brepintcs +//purpose : //======================================================================= - -static Standard_Integer brepintcs(Draw_Interpretor& , Standard_Integer n, const char** a) +Standard_Integer brepintcs(Draw_Interpretor& , Standard_Integer n, const char** a) { if (n <= 2) return 1; TopoDS_Shape S = DBRep::Get(a[n-1]); @@ -247,40 +324,12 @@ static Standard_Integer brepintcs(Draw_Interpretor& , Standard_Integer n, const //POP pour NT return 0; } - - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -//#include -#include -#include -#include -#include -#include -#include - -static void SampleEdges (const TopoDS_Shape& theShape, TColgp_SequenceOfPnt& theSeq); -static TopoDS_Face NextFaceForPrism (const TopoDS_Shape& shape, - const TopoDS_Shape& basis, - const gp_Ax1& ax1); - //======================================================================= -// intgo +//function : MakeBoss +//purpose : //======================================================================= -static Standard_Integer MakeBoss(Draw_Interpretor& , Standard_Integer , const char** a) +Standard_Integer MakeBoss(Draw_Interpretor& , Standard_Integer , const char** a) { - - TopoDS_Shape myS = DBRep::Get( a[2] ); TopoDS_Shape myBasis = DBRep::Get( a[3] ) ; @@ -306,18 +355,11 @@ static Standard_Integer MakeBoss(Draw_Interpretor& , Standard_Integer , const ch return 0; } - -#include -#include -//#include -#include -#include -#include - //======================================================================= -// Create a shell +//function : MakeShell +//purpose : //======================================================================= -static Standard_Integer MakeShell(Draw_Interpretor& , Standard_Integer , const char** a) +Standard_Integer MakeShell(Draw_Interpretor& , Standard_Integer , const char** a) { TopoDS_Shape aShape = DBRep::Get( a[1] ); @@ -342,7 +384,6 @@ static Standard_Integer MakeShell(Draw_Interpretor& , Standard_Integer , const c } return 0; } - //======================================================================= //function : xbounds //purpose : @@ -387,53 +428,78 @@ Standard_Integer xbounds(Draw_Interpretor& di, Standard_Integer n, const char** // return 0; } - //======================================================================= -//function : OtherCommands +//function : xclassify //purpose : //======================================================================= - -void BRepTest::OtherCommands(Draw_Interpretor& theCommands) +Standard_Integer xclassify (Draw_Interpretor& aDI, Standard_Integer n, const char** a) { - static Standard_Boolean done = Standard_False; - if (done) return; - done = Standard_True; - - const char* g = "TOPOLOGY other commands"; - - theCommands.Add("shape", - "shape name V/E/W/F/Sh/So/CS/C; make a empty shape",__FILE__,emptyshape,g); - - theCommands.Add("subshape", - "subshape name V/E/W/F/Sh/So/CS/C index; get subsshape of given type" - ,__FILE__,subshape,g); - - theCommands.Add("BRepIntCS", - "Calcul d'intersection entre face et curve : BRepIntCS curve shape" - ,__FILE__,brepintcs,g); - - theCommands.Add("makeboss", - "create a boss on the shape myS", __FILE__, MakeBoss, g); - - theCommands.Add("mksh", - "create a shell on Shape", __FILE__, MakeShell, g); - - - theCommands.Add("xbounds", - "xbounds face", __FILE__, xbounds, g); - + char sbf[512]; + + if (n < 2) { + aDI<<" use xclassify Solid [Tolerance=1.e-7]\n"; + return 1; + } + + TopoDS_Shape aS = DBRep::Get(a[1]); + if (aS.IsNull()) { + aDI<<" Null Shape is not allowed here\n"; + return 0; + } + + if (aS.ShapeType()!=TopAbs_SOLID) { + aDI<< " Shape type must be SOLID\n"; + return 0; + } + // + Standard_Real aTol=1.e-7; + TopAbs_State aState = TopAbs_UNKNOWN; + // + aTol=1.e-7; + if (n==3) { + aTol=atof(a[2]); + } + // + BRepClass3d_SolidClassifier aSC(aS); + aSC.PerformInfinitePoint(aTol); + + aState = aSC.State(); + PrintState(aDI, aState); + // + return 0; +} +//======================================================================= +//function : PrintState +//purpose : +//======================================================================= +void PrintState (Draw_Interpretor& aDI, + const TopAbs_State& aState) +{ + aDI<<"state is: "; + switch (aState) { + case TopAbs_IN: + aDI<<"IN\n"; + break; + case TopAbs_OUT: + aDI<<"OUT\n"; + break; + case TopAbs_ON: + aDI<<"ON\n"; + break; + case TopAbs_UNKNOWN: + default: + aDI<<"UNKNOWN\n"; + break; + } } - - - //======================================================================= //function : NextFaceForPrism //purpose : Search a face from which intersects with a line of // direction and location a point of . //======================================================================= -static TopoDS_Face NextFaceForPrism (const TopoDS_Shape& shape, - const TopoDS_Shape& basis, - const gp_Ax1& ax1) +TopoDS_Face NextFaceForPrism (const TopoDS_Shape& shape, + const TopoDS_Shape& basis, + const gp_Ax1& ax1) { TopoDS_Face nextFace; @@ -465,14 +531,13 @@ static TopoDS_Face NextFaceForPrism (const TopoDS_Shape& shape, return nextFace; } -#include //======================================================================= //function : SampleEdges //purpose : Sampling of . //design : Collect the vertices and points on the edges //======================================================================= -static void SampleEdges (const TopoDS_Shape& theShape, TColgp_SequenceOfPnt& theSeq) +void SampleEdges (const TopoDS_Shape& theShape, TColgp_SequenceOfPnt& theSeq) { theSeq.Clear(); diff --git a/src/IntCurveSurface/IntCurveSurface_Inter.gxx b/src/IntCurveSurface/IntCurveSurface_Inter.gxx index 56a4f243d9..5d9673358f 100755 --- a/src/IntCurveSurface/IntCurveSurface_Inter.gxx +++ b/src/IntCurveSurface/IntCurveSurface_Inter.gxx @@ -25,7 +25,7 @@ #define TOLTANGENCY 0.00000001 -#define TOLERANCE_ANGULAIRE 0.00000001 +#define TOLERANCE_ANGULAIRE 1.e-12//0.00000001 #define TOLERANCE 0.00000001 #define NBSAMPLESONCIRCLE 32