From 569aff1e98b93df066e9201f89dbec928990564d Mon Sep 17 00:00:00 2001 From: ama Date: Mon, 16 Apr 2012 12:17:31 +0400 Subject: [PATCH] 0022826: Increasiong of perfomance of fixes applied during translation of STEP files. Modification draw command "proj" and class GeomAPI_ProjectPointOnSurf: adding the ability to use UBTree algorithm to find projection in Extrema_GenExtPS. --- src/GeomAPI/GeomAPI_ProjectPointOnSurf.cdl | 31 ++++++++----- src/GeomAPI/GeomAPI_ProjectPointOnSurf.cxx | 45 ++++++++++++------- src/GeometryTest/GeometryTest_APICommands.cxx | 13 ++++-- 3 files changed, 61 insertions(+), 28 deletions(-) diff --git a/src/GeomAPI/GeomAPI_ProjectPointOnSurf.cdl b/src/GeomAPI/GeomAPI_ProjectPointOnSurf.cdl index df53feb814..6a42850191 100755 --- a/src/GeomAPI/GeomAPI_ProjectPointOnSurf.cdl +++ b/src/GeomAPI/GeomAPI_ProjectPointOnSurf.cdl @@ -30,6 +30,7 @@ class ProjectPointOnSurf from GeomAPI uses Surface from Geom, ExtPS from Extrema, + ExtAlgo from Extrema, Pnt from gp, Length from Quantity, Parameter from Quantity, @@ -50,7 +51,8 @@ is Create(P : Pnt from gp; - Surface : Surface from Geom) + Surface : Surface from Geom; + Algo : ExtAlgo from Extrema = Extrema_ExtAlgo_Grad) ---Purpose: Create the projection of a point

on a surface -- ---Level: Public @@ -58,7 +60,8 @@ is Create(P : Pnt from gp; Surface : Surface from Geom; - Tolerance : Real from Standard) + Tolerance : Real from Standard; + Algo : ExtAlgo from Extrema = Extrema_ExtAlgo_Grad) ---Purpose: Create the projection of a point

on a surface -- ---Level: Public @@ -74,13 +77,15 @@ is Surface : Surface from Geom; Umin, Usup, Vmin, Vsup : Parameter from Quantity; - Tolerance : Real from Standard) + Tolerance : Real from Standard; + Algo : ExtAlgo from Extrema = Extrema_ExtAlgo_Grad) returns ProjectPointOnSurf from GeomAPI; Create(P : Pnt from gp; Surface : Surface from Geom; Umin, Usup, - Vmin, Vsup : Parameter from Quantity) + Vmin, Vsup : Parameter from Quantity; + Algo : ExtAlgo from Extrema = Extrema_ExtAlgo_Grad) returns ProjectPointOnSurf from GeomAPI; @@ -91,12 +96,14 @@ is Init(me : in out; P : Pnt from gp; Surface : Surface from Geom; - Tolerance : Real from Standard) + Tolerance : Real from Standard; + Algo : ExtAlgo from Extrema = Extrema_ExtAlgo_Grad) is static; Init(me : in out; P : Pnt from gp; - Surface : Surface from Geom) + Surface : Surface from Geom; + Algo : ExtAlgo from Extrema = Extrema_ExtAlgo_Grad) is static; @@ -110,7 +117,8 @@ is Surface : Surface from Geom; Umin, Usup, Vmin, Vsup : Parameter from Quantity; - Tolerance : Real from Standard) + Tolerance : Real from Standard; + Algo : ExtAlgo from Extrema = Extrema_ExtAlgo_Grad) ---Level: Public is static; @@ -118,7 +126,8 @@ is P : Pnt from gp; Surface : Surface from Geom; Umin, Usup, - Vmin, Vsup : Parameter from Quantity) + Vmin, Vsup : Parameter from Quantity; + Algo : ExtAlgo from Extrema = Extrema_ExtAlgo_Grad) is static; @@ -131,13 +140,15 @@ is Surface : Surface from Geom; Umin, Usup, Vmin, Vsup : Parameter from Quantity; - Tolerance : Real from Standard) + Tolerance : Real from Standard; + Algo : ExtAlgo from Extrema = Extrema_ExtAlgo_Grad) is static; Init(me : in out; Surface : Surface from Geom; Umin, Usup, - Vmin, Vsup : Parameter from Quantity) + Vmin, Vsup : Parameter from Quantity; + Algo : ExtAlgo from Extrema = Extrema_ExtAlgo_Grad) is static; diff --git a/src/GeomAPI/GeomAPI_ProjectPointOnSurf.cxx b/src/GeomAPI/GeomAPI_ProjectPointOnSurf.cxx index ecffbdcc7b..a54a89aafb 100755 --- a/src/GeomAPI/GeomAPI_ProjectPointOnSurf.cxx +++ b/src/GeomAPI/GeomAPI_ProjectPointOnSurf.cxx @@ -39,9 +39,10 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf() //purpose : //======================================================================= GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf (const gp_Pnt& P, - const Handle(Geom_Surface)& Surface) + const Handle(Geom_Surface)& Surface, + const Extrema_ExtAlgo theProjAlgo) { - Init (P, Surface); + Init (P, Surface, theProjAlgo); } //======================================================================= //function : GeomAPI_ProjectPointOnSurf @@ -49,9 +50,10 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf() //======================================================================= GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf (const gp_Pnt& P, const Handle(Geom_Surface)& Surface, - const Standard_Real Tolerance) + const Standard_Real Tolerance, + const Extrema_ExtAlgo theProjAlgo) { - Init (P, Surface, Tolerance); + Init (P, Surface, Tolerance, theProjAlgo); } //======================================================================= //function : GeomAPI_ProjectPointOnSurf @@ -62,10 +64,11 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf() const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, - const Standard_Real Vsup) + const Standard_Real Vsup, + const Extrema_ExtAlgo theProjAlgo) { - Init (P, Surface, Umin, Usup, Vmin, Vsup); + Init (P, Surface, Umin, Usup, Vmin, Vsup, theProjAlgo); } //======================================================================= //function : GeomAPI_ProjectPointOnSurf @@ -77,10 +80,11 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf() const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, - const Standard_Real Tolerance) + const Standard_Real Tolerance, + const Extrema_ExtAlgo theProjAlgo) { - Init (P, Surface, Umin, Usup, Vmin, Vsup, Tolerance); + Init (P, Surface, Umin, Usup, Vmin, Vsup, Tolerance, theProjAlgo); } //======================================================================= //function : Init @@ -109,10 +113,11 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf() //purpose : //======================================================================= void GeomAPI_ProjectPointOnSurf::Init (const gp_Pnt& P, - const Handle(Geom_Surface)& Surface) + const Handle(Geom_Surface)& Surface, + const Extrema_ExtAlgo theProjAlgo) { - Init (P, Surface, Precision::Confusion()); + Init (P, Surface, Precision::Confusion(), theProjAlgo); } //======================================================================= //function : Init @@ -120,7 +125,8 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf() //======================================================================= void GeomAPI_ProjectPointOnSurf::Init(const gp_Pnt& P, const Handle(Geom_Surface)& Surface, - const Standard_Real Tolerance) + const Standard_Real Tolerance, + const Extrema_ExtAlgo theProjAlgo) { //modified by NIZNHY-PKV Thu Apr 4 10:37:55 2002 f @@ -133,6 +139,7 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf() myGeomAdaptor.Load(Surface, Umin, Usup, Vmin, Vsup); // //myExtPS = Extrema_ExtPS(); + myExtPS.SetAlgo(theProjAlgo); myExtPS.Initialize(myGeomAdaptor, Umin, Usup, Vmin, Vsup, Tolerance, Tolerance); myExtPS.Perform(P); //XXXmyExtPS = Extrema_ExtPS (P, myGeomAdaptor, Tolerance, Tolerance); @@ -152,7 +159,8 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf() const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, - const Standard_Real Vsup ) + const Standard_Real Vsup, + const Extrema_ExtAlgo theProjAlgo) { Standard_Real Tolerance = Precision::PConfusion(); //modified by NIZNHY-PKV Thu Apr 4 10:38:23 2002 f @@ -160,6 +168,7 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf() //myExtPS = Extrema_ExtPS (P, TheSurface, Tol, Tol); myGeomAdaptor.Load(Surface, Umin,Usup,Vmin,Vsup); //myExtPS = Extrema_ExtPS(); + myExtPS.SetAlgo(theProjAlgo); myExtPS.Initialize(myGeomAdaptor, Umin, Usup, Vmin, Vsup, Tolerance, Tolerance); myExtPS.Perform(P); //XXX myExtPS = Extrema_ExtPS (P, myGeomAdaptor, Tol, Tol); @@ -177,13 +186,15 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf() const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, - const Standard_Real Tolerance) + const Standard_Real Tolerance, + const Extrema_ExtAlgo theProjAlgo) { //modified by NIZNHY-PKV Thu Apr 4 10:39:10 2002 f //GeomAdaptor_Surface TheSurface (Surface,Umin,Usup,Vmin,Vsup); //myExtPS = Extrema_ExtPS (P, TheSurface, Tolerance, Tolerance); myGeomAdaptor.Load(Surface, Umin,Usup,Vmin,Vsup); //myExtPS = Extrema_ExtPS(); + myExtPS.SetAlgo(theProjAlgo); myExtPS.Initialize(myGeomAdaptor, Umin, Usup, Vmin, Vsup, Tolerance, Tolerance); myExtPS.Perform(P); //XXX myExtPS = Extrema_ExtPS (P, myGeomAdaptor, Tolerance, Tolerance); @@ -198,7 +209,8 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf() const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, - const Standard_Real Vsup ) + const Standard_Real Vsup, + const Extrema_ExtAlgo theProjAlgo) { Standard_Real Tolerance = Precision::PConfusion(); //modified by NIZNHY-PKV Thu Apr 4 10:41:50 2002 f @@ -208,6 +220,7 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf() //myExtPS = Extrema_ExtPS(); //modified by NIZNHY-PKV Thu Apr 4 10:42:32 2002 f //myExtPS.Initialize(TheSurface, Umin, Usup, Vmin, Vsup, Tol, Tol); + myExtPS.SetAlgo(theProjAlgo); myExtPS.Initialize(myGeomAdaptor, Umin, Usup, Vmin, Vsup, Tolerance, Tolerance); //modified by NIZNHY-PKV Thu Apr 4 10:42:39 2002 t myIsDone = Standard_False; @@ -221,7 +234,8 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf() const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, - const Standard_Real Tolerance) + const Standard_Real Tolerance, + const Extrema_ExtAlgo theProjAlgo) { //modified by NIZNHY-PKV Thu Apr 4 10:43:00 2002 f //GeomAdaptor_Surface TheSurface (Surface,Umin,Usup,Vmin,Vsup); @@ -230,6 +244,7 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf() //myExtPS = Extrema_ExtPS(); //modified by NIZNHY-PKV Thu Apr 4 10:43:18 2002 f //myExtPS.Initialize(TheSurface, Umin, Usup, Vmin, Vsup, Tolerance, Tolerance); + myExtPS.SetAlgo(theProjAlgo); myExtPS.Initialize(myGeomAdaptor, Umin, Usup, Vmin, Vsup, Tolerance, Tolerance); //modified by NIZNHY-PKV Thu Apr 4 10:43:26 2002 t myIsDone = Standard_False; diff --git a/src/GeometryTest/GeometryTest_APICommands.cxx b/src/GeometryTest/GeometryTest_APICommands.cxx index f9728f9a6b..53ded2477e 100755 --- a/src/GeometryTest/GeometryTest_APICommands.cxx +++ b/src/GeometryTest/GeometryTest_APICommands.cxx @@ -56,7 +56,11 @@ Standard_IMPORT Draw_Viewer dout; static Standard_Integer proj (Draw_Interpretor& di, Standard_Integer n, const char** a) { - if ( n < 5) return 1; + if ( n < 5) + { + cout << " Use proj curve/surf x y z [extrema algo: g(grad)/t(tree)]" << endl; + return 1; + } gp_Pnt P(atof(a[2]),atof(a[3]),atof(a[4])); @@ -64,6 +68,9 @@ static Standard_Integer proj (Draw_Interpretor& di, Standard_Integer n, const ch Handle(Geom_Curve) GC = DrawTrSurf::GetCurve(a[1]); Handle(Geom_Surface) GS; + Extrema_ExtAlgo aProjAlgo = Extrema_ExtAlgo_Grad; + if (n == 6 && a[5][0] == 't') + aProjAlgo = Extrema_ExtAlgo_Tree; if (GC.IsNull()) { GS = DrawTrSurf::GetSurface(a[1]); @@ -72,7 +79,7 @@ static Standard_Integer proj (Draw_Interpretor& di, Standard_Integer n, const ch Standard_Real U1, U2, V1, V2; GS->Bounds(U1,U2,V1,V2); - GeomAPI_ProjectPointOnSurf proj(P,GS,U1,U2,V1,V2); + GeomAPI_ProjectPointOnSurf proj(P,GS,U1,U2,V1,V2,aProjAlgo); Standard_Real UU,VV; for ( Standard_Integer i = 1; i <= proj.NbPoints(); i++) { gp_Pnt P1 = proj.Point(i); @@ -492,7 +499,7 @@ void GeometryTest::APICommands(Draw_Interpretor& theCommands) g = "GEOMETRY curves and surfaces analysis"; - theCommands.Add("proj", "proj curve/surf x y z",__FILE__, proj); + theCommands.Add("proj", "proj curve/surf x y z [extrema algo: g(grad)/t(tree)]",__FILE__, proj); g = "GEOMETRY approximations";