1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-05 18:16:23 +03:00

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.
This commit is contained in:
ama 2012-04-16 12:17:31 +04:00
parent 5368adff54
commit 569aff1e98
3 changed files with 61 additions and 28 deletions

View File

@ -30,6 +30,7 @@ class ProjectPointOnSurf from GeomAPI
uses uses
Surface from Geom, Surface from Geom,
ExtPS from Extrema, ExtPS from Extrema,
ExtAlgo from Extrema,
Pnt from gp, Pnt from gp,
Length from Quantity, Length from Quantity,
Parameter from Quantity, Parameter from Quantity,
@ -50,7 +51,8 @@ is
Create(P : Pnt from gp; 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 <P> on a surface ---Purpose: Create the projection of a point <P> on a surface
-- <Surface> -- <Surface>
---Level: Public ---Level: Public
@ -58,7 +60,8 @@ is
Create(P : Pnt from gp; Create(P : Pnt from gp;
Surface : Surface from Geom; 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 <P> on a surface ---Purpose: Create the projection of a point <P> on a surface
-- <Surface> -- <Surface>
---Level: Public ---Level: Public
@ -74,13 +77,15 @@ is
Surface : Surface from Geom; Surface : Surface from Geom;
Umin, Usup, Umin, Usup,
Vmin, Vsup : Parameter from Quantity; Vmin, Vsup : Parameter from Quantity;
Tolerance : Real from Standard) Tolerance : Real from Standard;
Algo : ExtAlgo from Extrema = Extrema_ExtAlgo_Grad)
returns ProjectPointOnSurf from GeomAPI; returns ProjectPointOnSurf from GeomAPI;
Create(P : Pnt from gp; Create(P : Pnt from gp;
Surface : Surface from Geom; Surface : Surface from Geom;
Umin, Usup, Umin, Usup,
Vmin, Vsup : Parameter from Quantity) Vmin, Vsup : Parameter from Quantity;
Algo : ExtAlgo from Extrema = Extrema_ExtAlgo_Grad)
returns ProjectPointOnSurf from GeomAPI; returns ProjectPointOnSurf from GeomAPI;
@ -91,12 +96,14 @@ is
Init(me : in out; Init(me : in out;
P : Pnt from gp; P : Pnt from gp;
Surface : Surface from Geom; Surface : Surface from Geom;
Tolerance : Real from Standard) Tolerance : Real from Standard;
Algo : ExtAlgo from Extrema = Extrema_ExtAlgo_Grad)
is static; is static;
Init(me : in out; Init(me : in out;
P : Pnt from gp; P : Pnt from gp;
Surface : Surface from Geom) Surface : Surface from Geom;
Algo : ExtAlgo from Extrema = Extrema_ExtAlgo_Grad)
is static; is static;
@ -110,7 +117,8 @@ is
Surface : Surface from Geom; Surface : Surface from Geom;
Umin, Usup, Umin, Usup,
Vmin, Vsup : Parameter from Quantity; Vmin, Vsup : Parameter from Quantity;
Tolerance : Real from Standard) Tolerance : Real from Standard;
Algo : ExtAlgo from Extrema = Extrema_ExtAlgo_Grad)
---Level: Public ---Level: Public
is static; is static;
@ -118,7 +126,8 @@ is
P : Pnt from gp; P : Pnt from gp;
Surface : Surface from Geom; Surface : Surface from Geom;
Umin, Usup, Umin, Usup,
Vmin, Vsup : Parameter from Quantity) Vmin, Vsup : Parameter from Quantity;
Algo : ExtAlgo from Extrema = Extrema_ExtAlgo_Grad)
is static; is static;
@ -131,13 +140,15 @@ is
Surface : Surface from Geom; Surface : Surface from Geom;
Umin, Usup, Umin, Usup,
Vmin, Vsup : Parameter from Quantity; Vmin, Vsup : Parameter from Quantity;
Tolerance : Real from Standard) Tolerance : Real from Standard;
Algo : ExtAlgo from Extrema = Extrema_ExtAlgo_Grad)
is static; is static;
Init(me : in out; Init(me : in out;
Surface : Surface from Geom; Surface : Surface from Geom;
Umin, Usup, Umin, Usup,
Vmin, Vsup : Parameter from Quantity) Vmin, Vsup : Parameter from Quantity;
Algo : ExtAlgo from Extrema = Extrema_ExtAlgo_Grad)
is static; is static;

View File

@ -39,9 +39,10 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf()
//purpose : //purpose :
//======================================================================= //=======================================================================
GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf (const gp_Pnt& P, 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 //function : GeomAPI_ProjectPointOnSurf
@ -49,9 +50,10 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf()
//======================================================================= //=======================================================================
GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf (const gp_Pnt& P, GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf (const gp_Pnt& P,
const Handle(Geom_Surface)& Surface, 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 //function : GeomAPI_ProjectPointOnSurf
@ -62,10 +64,11 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf()
const Standard_Real Umin, const Standard_Real Umin,
const Standard_Real Usup, const Standard_Real Usup,
const Standard_Real Vmin, 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 //function : GeomAPI_ProjectPointOnSurf
@ -77,10 +80,11 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf()
const Standard_Real Usup, const Standard_Real Usup,
const Standard_Real Vmin, const Standard_Real Vmin,
const Standard_Real Vsup, 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 //function : Init
@ -109,10 +113,11 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf()
//purpose : //purpose :
//======================================================================= //=======================================================================
void GeomAPI_ProjectPointOnSurf::Init (const gp_Pnt& P, 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 //function : Init
@ -120,7 +125,8 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf()
//======================================================================= //=======================================================================
void GeomAPI_ProjectPointOnSurf::Init(const gp_Pnt& P, void GeomAPI_ProjectPointOnSurf::Init(const gp_Pnt& P,
const Handle(Geom_Surface)& Surface, 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 //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); myGeomAdaptor.Load(Surface, Umin, Usup, Vmin, Vsup);
// //
//myExtPS = Extrema_ExtPS(); //myExtPS = Extrema_ExtPS();
myExtPS.SetAlgo(theProjAlgo);
myExtPS.Initialize(myGeomAdaptor, Umin, Usup, Vmin, Vsup, Tolerance, Tolerance); myExtPS.Initialize(myGeomAdaptor, Umin, Usup, Vmin, Vsup, Tolerance, Tolerance);
myExtPS.Perform(P); myExtPS.Perform(P);
//XXXmyExtPS = Extrema_ExtPS (P, myGeomAdaptor, Tolerance, Tolerance); //XXXmyExtPS = Extrema_ExtPS (P, myGeomAdaptor, Tolerance, Tolerance);
@ -152,7 +159,8 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf()
const Standard_Real Umin, const Standard_Real Umin,
const Standard_Real Usup, const Standard_Real Usup,
const Standard_Real Vmin, const Standard_Real Vmin,
const Standard_Real Vsup ) const Standard_Real Vsup,
const Extrema_ExtAlgo theProjAlgo)
{ {
Standard_Real Tolerance = Precision::PConfusion(); Standard_Real Tolerance = Precision::PConfusion();
//modified by NIZNHY-PKV Thu Apr 4 10:38:23 2002 f //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); //myExtPS = Extrema_ExtPS (P, TheSurface, Tol, Tol);
myGeomAdaptor.Load(Surface, Umin,Usup,Vmin,Vsup); myGeomAdaptor.Load(Surface, Umin,Usup,Vmin,Vsup);
//myExtPS = Extrema_ExtPS(); //myExtPS = Extrema_ExtPS();
myExtPS.SetAlgo(theProjAlgo);
myExtPS.Initialize(myGeomAdaptor, Umin, Usup, Vmin, Vsup, Tolerance, Tolerance); myExtPS.Initialize(myGeomAdaptor, Umin, Usup, Vmin, Vsup, Tolerance, Tolerance);
myExtPS.Perform(P); myExtPS.Perform(P);
//XXX myExtPS = Extrema_ExtPS (P, myGeomAdaptor, Tol, Tol); //XXX myExtPS = Extrema_ExtPS (P, myGeomAdaptor, Tol, Tol);
@ -177,13 +186,15 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf()
const Standard_Real Usup, const Standard_Real Usup,
const Standard_Real Vmin, const Standard_Real Vmin,
const Standard_Real Vsup, 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 //modified by NIZNHY-PKV Thu Apr 4 10:39:10 2002 f
//GeomAdaptor_Surface TheSurface (Surface,Umin,Usup,Vmin,Vsup); //GeomAdaptor_Surface TheSurface (Surface,Umin,Usup,Vmin,Vsup);
//myExtPS = Extrema_ExtPS (P, TheSurface, Tolerance, Tolerance); //myExtPS = Extrema_ExtPS (P, TheSurface, Tolerance, Tolerance);
myGeomAdaptor.Load(Surface, Umin,Usup,Vmin,Vsup); myGeomAdaptor.Load(Surface, Umin,Usup,Vmin,Vsup);
//myExtPS = Extrema_ExtPS(); //myExtPS = Extrema_ExtPS();
myExtPS.SetAlgo(theProjAlgo);
myExtPS.Initialize(myGeomAdaptor, Umin, Usup, Vmin, Vsup, Tolerance, Tolerance); myExtPS.Initialize(myGeomAdaptor, Umin, Usup, Vmin, Vsup, Tolerance, Tolerance);
myExtPS.Perform(P); myExtPS.Perform(P);
//XXX myExtPS = Extrema_ExtPS (P, myGeomAdaptor, Tolerance, Tolerance); //XXX myExtPS = Extrema_ExtPS (P, myGeomAdaptor, Tolerance, Tolerance);
@ -198,7 +209,8 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf()
const Standard_Real Umin, const Standard_Real Umin,
const Standard_Real Usup, const Standard_Real Usup,
const Standard_Real Vmin, const Standard_Real Vmin,
const Standard_Real Vsup ) const Standard_Real Vsup,
const Extrema_ExtAlgo theProjAlgo)
{ {
Standard_Real Tolerance = Precision::PConfusion(); Standard_Real Tolerance = Precision::PConfusion();
//modified by NIZNHY-PKV Thu Apr 4 10:41:50 2002 f //modified by NIZNHY-PKV Thu Apr 4 10:41:50 2002 f
@ -208,6 +220,7 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf()
//myExtPS = Extrema_ExtPS(); //myExtPS = Extrema_ExtPS();
//modified by NIZNHY-PKV Thu Apr 4 10:42:32 2002 f //modified by NIZNHY-PKV Thu Apr 4 10:42:32 2002 f
//myExtPS.Initialize(TheSurface, Umin, Usup, Vmin, Vsup, Tol, Tol); //myExtPS.Initialize(TheSurface, Umin, Usup, Vmin, Vsup, Tol, Tol);
myExtPS.SetAlgo(theProjAlgo);
myExtPS.Initialize(myGeomAdaptor, Umin, Usup, Vmin, Vsup, Tolerance, Tolerance); myExtPS.Initialize(myGeomAdaptor, Umin, Usup, Vmin, Vsup, Tolerance, Tolerance);
//modified by NIZNHY-PKV Thu Apr 4 10:42:39 2002 t //modified by NIZNHY-PKV Thu Apr 4 10:42:39 2002 t
myIsDone = Standard_False; myIsDone = Standard_False;
@ -221,7 +234,8 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf()
const Standard_Real Usup, const Standard_Real Usup,
const Standard_Real Vmin, const Standard_Real Vmin,
const Standard_Real Vsup, 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 //modified by NIZNHY-PKV Thu Apr 4 10:43:00 2002 f
//GeomAdaptor_Surface TheSurface (Surface,Umin,Usup,Vmin,Vsup); //GeomAdaptor_Surface TheSurface (Surface,Umin,Usup,Vmin,Vsup);
@ -230,6 +244,7 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf()
//myExtPS = Extrema_ExtPS(); //myExtPS = Extrema_ExtPS();
//modified by NIZNHY-PKV Thu Apr 4 10:43:18 2002 f //modified by NIZNHY-PKV Thu Apr 4 10:43:18 2002 f
//myExtPS.Initialize(TheSurface, Umin, Usup, Vmin, Vsup, Tolerance, Tolerance); //myExtPS.Initialize(TheSurface, Umin, Usup, Vmin, Vsup, Tolerance, Tolerance);
myExtPS.SetAlgo(theProjAlgo);
myExtPS.Initialize(myGeomAdaptor, Umin, Usup, Vmin, Vsup, Tolerance, Tolerance); myExtPS.Initialize(myGeomAdaptor, Umin, Usup, Vmin, Vsup, Tolerance, Tolerance);
//modified by NIZNHY-PKV Thu Apr 4 10:43:26 2002 t //modified by NIZNHY-PKV Thu Apr 4 10:43:26 2002 t
myIsDone = Standard_False; myIsDone = Standard_False;

View File

@ -56,7 +56,11 @@ Standard_IMPORT Draw_Viewer dout;
static Standard_Integer proj (Draw_Interpretor& di, Standard_Integer n, const char** a) 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])); 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_Curve) GC = DrawTrSurf::GetCurve(a[1]);
Handle(Geom_Surface) GS; Handle(Geom_Surface) GS;
Extrema_ExtAlgo aProjAlgo = Extrema_ExtAlgo_Grad;
if (n == 6 && a[5][0] == 't')
aProjAlgo = Extrema_ExtAlgo_Tree;
if (GC.IsNull()) { if (GC.IsNull()) {
GS = DrawTrSurf::GetSurface(a[1]); 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; Standard_Real U1, U2, V1, V2;
GS->Bounds(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; Standard_Real UU,VV;
for ( Standard_Integer i = 1; i <= proj.NbPoints(); i++) { for ( Standard_Integer i = 1; i <= proj.NbPoints(); i++) {
gp_Pnt P1 = proj.Point(i); gp_Pnt P1 = proj.Point(i);
@ -492,7 +499,7 @@ void GeometryTest::APICommands(Draw_Interpretor& theCommands)
g = "GEOMETRY curves and surfaces analysis"; 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"; g = "GEOMETRY approximations";