mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
0022887: Request to make Intf_InterferencePolygon2d class thread-safe.
This commit is contained in:
@@ -52,8 +52,6 @@ is
|
||||
|
||||
class PolyArc; -- inherits Polygo from IntPatch
|
||||
|
||||
class PolygoTool;
|
||||
|
||||
class RstInt;
|
||||
|
||||
|
||||
@@ -143,8 +141,7 @@ is
|
||||
HSurface from Adaptor3d,
|
||||
HSurfaceTool from Adaptor3d);
|
||||
|
||||
class SearchPnt instantiates InterferencePolygon2d from Intf
|
||||
(Polygo, PolygoTool, Polygo, PolygoTool);
|
||||
alias SearchPnt is InterferencePolygon2d from Intf;
|
||||
|
||||
class CSFunction instantiates ZerCOnSSParFunc from IntImp
|
||||
(HSurface from Adaptor3d,
|
||||
|
@@ -31,14 +31,7 @@ is
|
||||
--- This exception is raised if Pfirst=RealFirst or Plast=RealLast or
|
||||
-- NbSample<=1.
|
||||
|
||||
|
||||
Bounding(me)
|
||||
---C++: return const&
|
||||
returns Box2d from Bnd;
|
||||
|
||||
Error(me) returns Real from Standard;
|
||||
|
||||
Closed(me) returns Boolean from Standard;
|
||||
Closed(me) returns Boolean from Standard is redefined virtual;
|
||||
|
||||
NbPoints(me) returns Integer;
|
||||
|
||||
@@ -53,8 +46,6 @@ fields
|
||||
|
||||
brise : Array1OfPnt2d from TColgp;
|
||||
param : Array1OfReal from TColStd;
|
||||
boite : Box2d from Bnd;
|
||||
fleche : Real from Standard;
|
||||
offsetx: Real from Standard;
|
||||
offsety: Real from Standard;
|
||||
ferme : Boolean from Standard;
|
||||
|
@@ -72,10 +72,10 @@ IntPatch_PolyArc::IntPatch_PolyArc(const Handle(Adaptor2d_HCurve2d)& Line ,
|
||||
Xs = p2d.X(); Ys = p2d.Y();
|
||||
brise(1).SetCoord(Xs,Ys);
|
||||
|
||||
boite.SetVoid();
|
||||
myBox.SetVoid();
|
||||
|
||||
boite.Add(brise(1));
|
||||
fleche =0.;
|
||||
myBox.Add(brise(1));
|
||||
myError =0.;
|
||||
|
||||
for (Standard_Integer i =2; i<=NbSample;i++) {
|
||||
param(i) = Pdeb + (i-1)*Pas;
|
||||
@@ -111,12 +111,12 @@ IntPatch_PolyArc::IntPatch_PolyArc(const Handle(Adaptor2d_HCurve2d)& Line ,
|
||||
if(IndexSup<i) IndexSup=Min(i+1,NbSample);
|
||||
}
|
||||
|
||||
boite.Add(brise(i));
|
||||
myBox.Add(brise(i));
|
||||
Line->D0(param(i)-Pas*0.5,p2d);
|
||||
Xm = p2d.X() - XXs;
|
||||
Ym = p2d.Y() - YYs;
|
||||
Xm = Sqrt(Xm*Xm+Ym*Ym);
|
||||
fleche =Max (fleche , Xm);
|
||||
myError =Max (myError , Xm);
|
||||
Xs = X;
|
||||
Ys = Y;
|
||||
}
|
||||
@@ -145,25 +145,14 @@ IntPatch_PolyArc::IntPatch_PolyArc(const Handle(Adaptor2d_HCurve2d)& Line ,
|
||||
}
|
||||
}
|
||||
while((IndexInf > IndexSup) && nbloop<=10);
|
||||
fleche*=1.2;
|
||||
if(fleche<0.00000001)
|
||||
fleche = 0.00000001;
|
||||
boite.Enlarge(fleche);
|
||||
myError*=1.2;
|
||||
if(myError<0.00000001)
|
||||
myError = 0.00000001;
|
||||
myBox.Enlarge(myError);
|
||||
|
||||
if(Line->Value(aPdeb).Distance(Line->Value(aPfin))<=1e-7) {
|
||||
ferme=Standard_True;
|
||||
}
|
||||
else {
|
||||
ferme=Standard_False;
|
||||
}
|
||||
ferme = (Line->Value(aPdeb).Distance(Line->Value(aPfin)) <= 1e-7);
|
||||
}
|
||||
|
||||
const Bnd_Box2d& IntPatch_PolyArc::Bounding() const {
|
||||
return(boite);
|
||||
}
|
||||
|
||||
Standard_Real IntPatch_PolyArc::Error() const {return fleche;}
|
||||
|
||||
Standard_Boolean IntPatch_PolyArc::Closed() const { return ferme;}
|
||||
|
||||
Standard_Integer IntPatch_PolyArc::NbPoints() const {return brise.Length();}
|
||||
@@ -183,16 +172,16 @@ Standard_Real IntPatch_PolyArc::Parameter(const Standard_Integer Index ) const
|
||||
|
||||
void IntPatch_PolyArc::SetOffset(const Standard_Real ox,const Standard_Real oy) {
|
||||
Standard_Real xmin,ymin,xmax,ymax,g;
|
||||
boite.Get(xmin,ymin,xmax,ymax);
|
||||
g = boite.GetGap();
|
||||
myBox.Get(xmin,ymin,xmax,ymax);
|
||||
g = myBox.GetGap();
|
||||
|
||||
boite.SetVoid();
|
||||
myBox.SetVoid();
|
||||
|
||||
boite.Update(xmin-offsetx,ymin-offsety,
|
||||
myBox.Update(xmin-offsetx,ymin-offsety,
|
||||
xmax-offsetx,ymax-offsety);
|
||||
offsetx = ox;
|
||||
offsety = oy;
|
||||
boite.Update(xmin+offsetx,ymin+offsety,
|
||||
myBox.Update(xmin+offsetx,ymin+offsety,
|
||||
xmax+offsetx,ymax+offsety);
|
||||
boite.SetGap(g);
|
||||
myBox.SetGap(g);
|
||||
}
|
||||
|
@@ -32,14 +32,6 @@ is
|
||||
|
||||
ResetError(me: in out);
|
||||
|
||||
Bounding (me)
|
||||
---C++: return const &
|
||||
returns Box2d from Bnd;
|
||||
|
||||
Error(me) returns Real from Standard;
|
||||
|
||||
Closed(me) returns Boolean from Standard;
|
||||
|
||||
NbPoints(me) returns Integer;
|
||||
|
||||
Point(me; Index : Integer)
|
||||
@@ -48,12 +40,10 @@ is
|
||||
|
||||
fields
|
||||
|
||||
box : Box2d from Bnd;
|
||||
pnt : Pnt2d from gp;
|
||||
typ : IType from IntPatch;
|
||||
onfirst : Boolean from Standard;
|
||||
wpoly : WLine from IntPatch;
|
||||
rpoly : RLine from IntPatch;
|
||||
defle : Real from Standard;
|
||||
|
||||
end PolyLine;
|
||||
|
@@ -18,7 +18,7 @@
|
||||
//=======================================================================
|
||||
|
||||
IntPatch_PolyLine::IntPatch_PolyLine ()
|
||||
: defle(INITDEFLE)
|
||||
: IntPatch_Polygo(INITDEFLE)
|
||||
{}
|
||||
|
||||
//=======================================================================
|
||||
@@ -27,7 +27,7 @@ IntPatch_PolyLine::IntPatch_PolyLine ()
|
||||
//=======================================================================
|
||||
|
||||
IntPatch_PolyLine::IntPatch_PolyLine (const Standard_Real InitDefle)
|
||||
: defle(InitDefle)
|
||||
: IntPatch_Polygo(InitDefle)
|
||||
{}
|
||||
|
||||
//=======================================================================
|
||||
@@ -64,9 +64,9 @@ void IntPatch_PolyLine::SetRLine(const Standard_Boolean OnFirst, const Handle(In
|
||||
void IntPatch_PolyLine::Prepare()
|
||||
{
|
||||
Standard_Integer i;
|
||||
box.SetVoid();
|
||||
myBox.SetVoid();
|
||||
Standard_Integer n=NbPoints();
|
||||
Standard_Real eps = defle;
|
||||
Standard_Real eps = myError;
|
||||
|
||||
gp_Pnt2d P1, P2;
|
||||
if (n >= 3) {
|
||||
@@ -82,7 +82,7 @@ void IntPatch_PolyLine::Prepare()
|
||||
d = V13.CrossMagnitude(V12) / d13;
|
||||
else
|
||||
d = eps;
|
||||
if (d > defle) {
|
||||
if (d > myError) {
|
||||
// try to compute deflection more precisely using parabola interpolation
|
||||
gp_XY V23 = P3.XY() - P2.XY();
|
||||
Standard_Real d12 = V12.Modulus(), d23 = V23.Modulus();
|
||||
@@ -119,13 +119,13 @@ void IntPatch_PolyLine::Prepare()
|
||||
// select min deflection from linear and parabolic ones
|
||||
if (d1 < d) d = d1;
|
||||
}
|
||||
if (d > defle) defle=d;
|
||||
if (d > myError) myError=d;
|
||||
}
|
||||
P1 = P2; P2 = P3;
|
||||
}
|
||||
box.Add(P3);
|
||||
myBox.Add(P3);
|
||||
}
|
||||
box.Enlarge(defle);
|
||||
myBox.Enlarge(myError);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -135,38 +135,7 @@ void IntPatch_PolyLine::Prepare()
|
||||
|
||||
void IntPatch_PolyLine::ResetError()
|
||||
{
|
||||
defle = INITDEFLE;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Bounding
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Bnd_Box2d& IntPatch_PolyLine::Bounding() const
|
||||
{
|
||||
return box;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Error
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real IntPatch_PolyLine::Error() const
|
||||
{
|
||||
// return 0.0000001;
|
||||
return defle;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Closed
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean IntPatch_PolyLine::Closed() const
|
||||
{
|
||||
return Standard_False;
|
||||
myError = INITDEFLE;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -1,38 +1,52 @@
|
||||
-- File: IntPatch_Polygo.cdl
|
||||
-- Created: Thu May 6 17:49:16 1993
|
||||
-- Author: Jacques GOUSSARD
|
||||
-- <jag@form4>
|
||||
---Copyright: Matra Datavision 1993
|
||||
-- File: IntPatch_Polygo.cdl
|
||||
-- Created: Thu May 6 17:49:16 1993
|
||||
-- Author: Jacques GOUSSARD
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
deferred class Polygo from IntPatch
|
||||
|
||||
---Purpose:
|
||||
|
||||
inherits Polygon2d from Intf
|
||||
|
||||
uses Pnt2d from gp,
|
||||
Box2d from Bnd
|
||||
|
||||
raises OutOfRange from Standard
|
||||
|
||||
is
|
||||
|
||||
Delete(me:out) is virtual;
|
||||
---C++: alias "Standard_EXPORT virtual ~IntPatch_Polygo(){Delete() ; }"
|
||||
|
||||
Bounding (me)
|
||||
---C++: return const &
|
||||
returns Box2d from Bnd
|
||||
is deferred;
|
||||
|
||||
Error(me) returns Real from Standard
|
||||
is deferred;
|
||||
|
||||
Closed(me) returns Boolean from Standard
|
||||
is deferred;
|
||||
Initialize (theError : Real from Standard = 0.0)
|
||||
returns Polygo from IntPatch;
|
||||
|
||||
Error (me) returns Real from Standard;
|
||||
---C++: inline
|
||||
|
||||
NbPoints (me) returns Integer is deferred;
|
||||
|
||||
Point (me; Index : Integer) returns Pnt2d from gp is deferred;
|
||||
|
||||
DeflectionOverEstimation (me)
|
||||
returns Real from Standard is redefined virtual;
|
||||
---C++: inline
|
||||
---Purpose: Returns the tolerance of the polygon.
|
||||
|
||||
NbSegments (me)
|
||||
returns Integer from Standard is redefined virtual;
|
||||
---C++: inline
|
||||
---Purpose: Returns the number of Segments in the polyline.
|
||||
|
||||
Segment (me; theIndex : in Integer from Standard;
|
||||
theBegin, theEnd : in out Pnt2d from gp)
|
||||
raises OutOfRange from Standard is redefined virtual;
|
||||
---C++: inline
|
||||
---Purpose: Returns the points of the segment <Index> in the Polygon.
|
||||
|
||||
Dump (me);
|
||||
|
||||
fields
|
||||
|
||||
myError : Real from Standard is protected;
|
||||
|
||||
NbPoints(me) returns Integer
|
||||
is deferred;
|
||||
|
||||
Point(me; Index : Integer)
|
||||
returns Pnt2d from gp
|
||||
is deferred;
|
||||
|
||||
end Polygo;
|
||||
|
@@ -1,4 +1,40 @@
|
||||
// File: IntPatch_Polygo.cxx
|
||||
// Created: Thu May 6 17:49:16 1993
|
||||
// Author: Jacques GOUSSARD
|
||||
// Copyright: Matra Datavision 1993
|
||||
|
||||
#include <IntPatch_Polygo.ixx>
|
||||
|
||||
void IntPatch_Polygo::Delete()
|
||||
//=======================================================================
|
||||
//function : Initialize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
IntPatch_Polygo::IntPatch_Polygo (const Standard_Real theError)
|
||||
: myError(theError)
|
||||
{}
|
||||
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IntPatch_Polygo::Dump () const
|
||||
{
|
||||
static int num=0;
|
||||
num++;
|
||||
cout<<"\n#------------- D u m p B o x 2 d ("<<num<<")"<<endl;
|
||||
Bounding().Dump();
|
||||
cout<<"\n#-----------------------------------------------"<<endl;
|
||||
|
||||
const Standard_Integer nbs = NbSegments();
|
||||
cout<<"\npol2d "<<num<<" "<<nbs<<" ";
|
||||
cout<<DeflectionOverEstimation()<<endl;
|
||||
|
||||
gp_Pnt2d P, PF;
|
||||
for(Standard_Integer i=1;i<=nbs;i++) {
|
||||
Segment(i,P,PF);
|
||||
cout<<"pnt2d "<<num<<" "<< P.X()<<" "<<P.Y()<<endl;
|
||||
}
|
||||
cout<<"pnt2d "<<num<<" "<< PF.X()<<" "<<PF.Y()<<endl;
|
||||
}
|
||||
|
47
src/IntPatch/IntPatch_Polygo.lxx
Normal file
47
src/IntPatch/IntPatch_Polygo.lxx
Normal file
@@ -0,0 +1,47 @@
|
||||
// File: IntPatch_Polygo.lxx
|
||||
// Created: Fri Feb 10 08:18:37 2012
|
||||
// Author: Sergey ZERCHANINOV
|
||||
// Copyright: OPEN CASCADE SAS 2012
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Error
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Real IntPatch_Polygo::Error () const
|
||||
{
|
||||
return myError;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DeflectionOverEstimation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Real IntPatch_Polygo::DeflectionOverEstimation () const
|
||||
{
|
||||
return myError;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbSegments
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Integer IntPatch_Polygo::NbSegments () const
|
||||
{
|
||||
return NbPoints()-1;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : BeginOfSeg
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline void IntPatch_Polygo::Segment (const Standard_Integer theIndex,
|
||||
gp_Pnt2d &theBegin, gp_Pnt2d &theEnd) const
|
||||
{
|
||||
theBegin = Point(theIndex);
|
||||
theEnd = Point(theIndex+1);
|
||||
}
|
@@ -1,65 +0,0 @@
|
||||
-- File: IntPatch_PolygoTool.cdl
|
||||
-- Created: Thu May 6 17:50:02 1993
|
||||
-- Author: Jacques GOUSSARD
|
||||
-- <jag@form4>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
|
||||
class PolygoTool from IntPatch
|
||||
|
||||
---Purpose: Tool an a polygon to instantiates the Interference
|
||||
-- between 2 polygons.
|
||||
|
||||
|
||||
uses Box2d from Bnd,
|
||||
Pnt2d from gp,
|
||||
Polygo from IntPatch
|
||||
|
||||
|
||||
is
|
||||
|
||||
Bounding (myclass; Line : Polygo from IntPatch )
|
||||
|
||||
returns Box2d from Bnd;
|
||||
---C++: return const &
|
||||
---C++: inline
|
||||
|
||||
|
||||
DeflectionOverEstimation(myclass; Line :Polygo from IntPatch)
|
||||
|
||||
returns Real from Standard;
|
||||
---C++: inline
|
||||
|
||||
|
||||
Closed(myclass; Line : Polygo from IntPatch )
|
||||
|
||||
returns Boolean from Standard;
|
||||
---C++: inline
|
||||
|
||||
|
||||
NbSegments(myclass; Line : Polygo from IntPatch )
|
||||
|
||||
returns Integer from Standard;
|
||||
---C++: inline
|
||||
|
||||
|
||||
BeginOfSeg(myclass; Line : Polygo from IntPatch;
|
||||
Index : Integer from Standard)
|
||||
|
||||
returns Pnt2d from gp;
|
||||
---C++: inline
|
||||
|
||||
|
||||
EndOfSeg(myclass; Line : Polygo from IntPatch ;
|
||||
Index : Integer from Standard)
|
||||
|
||||
returns Pnt2d from gp;
|
||||
---C++: inline
|
||||
|
||||
|
||||
Dump(myclass; Line : Polygo from IntPatch);
|
||||
|
||||
|
||||
end PolygoTool;
|
||||
|
||||
|
@@ -1,24 +0,0 @@
|
||||
#include <IntPatch_PolygoTool.ixx>
|
||||
|
||||
|
||||
|
||||
void IntPatch_PolygoTool::Dump(const IntPatch_Polygo& L) {
|
||||
static int num=0;
|
||||
num++;
|
||||
cout<<"\n#------------- D u m p B o x 2 d ("<<num<<")"<<endl;
|
||||
IntPatch_PolygoTool::Bounding(L).Dump();
|
||||
cout<<"\n#-----------------------------------------------"<<endl;
|
||||
|
||||
Standard_Integer nbs = IntPatch_PolygoTool::NbSegments(L);
|
||||
cout<<"\npol2d "<<num<<" "<<nbs<<" ";
|
||||
cout<<IntPatch_PolygoTool::DeflectionOverEstimation(L)<<endl;
|
||||
|
||||
for(Standard_Integer i=1;i<=nbs;i++) {
|
||||
gp_Pnt2d P(IntPatch_PolygoTool::BeginOfSeg(L,i));
|
||||
cout<<"pnt2d "<<num<<" "<< P.X()<<" "<<P.Y()<<endl;
|
||||
}
|
||||
gp_Pnt2d PF(IntPatch_PolygoTool::EndOfSeg(L,nbs));
|
||||
cout<<"pnt2d "<<num<<" "<< PF.X()<<" "<<PF.Y()<<endl;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,34 +0,0 @@
|
||||
#ifndef IntPatch_Polygo_HeaderFile
|
||||
#include <IntPatch_Polygo.hxx>
|
||||
#endif
|
||||
#ifndef Bnd_Box2d_HeaderFile
|
||||
#include <Bnd_Box2d.hxx>
|
||||
#endif
|
||||
#ifndef gp_Pnt2d_HeaderFile
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#endif
|
||||
|
||||
inline const Bnd_Box2d& IntPatch_PolygoTool::Bounding(const IntPatch_Polygo& Line)
|
||||
{ return Line.Bounding(); }
|
||||
|
||||
|
||||
inline Standard_Real IntPatch_PolygoTool::DeflectionOverEstimation
|
||||
(const IntPatch_Polygo& Line)
|
||||
{ return Line.Error();} // fleche non calculable
|
||||
|
||||
inline Standard_Boolean IntPatch_PolygoTool::Closed(const IntPatch_Polygo& Line)
|
||||
{ return Line.Closed();}
|
||||
|
||||
inline Standard_Integer IntPatch_PolygoTool::NbSegments(const IntPatch_Polygo& Line)
|
||||
{ return Line.NbPoints()-1;}
|
||||
|
||||
inline gp_Pnt2d IntPatch_PolygoTool::BeginOfSeg(const IntPatch_Polygo& Line,
|
||||
const Standard_Integer Index)
|
||||
{ return Line.Point(Index);}
|
||||
|
||||
|
||||
inline gp_Pnt2d IntPatch_PolygoTool::EndOfSeg(const IntPatch_Polygo& Line,
|
||||
const Standard_Integer Index)
|
||||
{ return Line.Point(Index+1);}
|
||||
|
||||
|
||||
|
@@ -9,7 +9,6 @@ class RstInt from IntPatch
|
||||
-- cheminement et les arcs de restriction
|
||||
|
||||
uses Polygo from IntPatch,
|
||||
PolygoTool from IntPatch,
|
||||
Line from IntPatch,
|
||||
HSurface from Adaptor3d,
|
||||
TopolTool from Adaptor3d
|
||||
|
@@ -26,7 +26,6 @@
|
||||
#include <Precision.hxx>
|
||||
|
||||
#include <Adaptor2d_HCurve2d.hxx>
|
||||
#include <IntPatch_PolygoTool.hxx>
|
||||
#include <IntPatch_WLine.hxx>
|
||||
#include <IntPatch_RLine.hxx>
|
||||
#include <IntPatch_HInterTool.hxx>
|
||||
@@ -572,7 +571,7 @@ void IntPatch_RstInt::PutVertexOnLine (Handle(IntPatch_Line)& L,
|
||||
}
|
||||
}
|
||||
|
||||
Bnd_Box2d BPLin = IntPatch_PolygoTool::Bounding(PLin);
|
||||
Bnd_Box2d BPLin = PLin.Bounding();
|
||||
|
||||
if(SurfaceIsPeriodic) {
|
||||
Standard_Real xmin,ymin,xmax,ymax,g;
|
||||
@@ -642,8 +641,8 @@ void IntPatch_RstInt::PutVertexOnLine (Handle(IntPatch_Line)& L,
|
||||
static int debug_polygon2d =0;
|
||||
if(debug_polygon2d) {
|
||||
cout<<" ***** Numero Restriction : "<<NumeroEdge<<" *****"<<endl;
|
||||
IntPatch_PolygoTool::Dump(PLin);
|
||||
IntPatch_PolygoTool::Dump(Brise);
|
||||
PLin.Dump();
|
||||
Brise.Dump();
|
||||
}
|
||||
|
||||
Commun.Perform(PLin,Brise);
|
||||
|
Reference in New Issue
Block a user