1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0022887: Request to make Intf_InterferencePolygon2d class thread-safe.

This commit is contained in:
azn
2012-03-12 18:31:11 +04:00
committed by bugmaster
parent d64e6d05d9
commit 9530af2780
34 changed files with 1054 additions and 1332 deletions

View File

@@ -3,6 +3,5 @@ IntCurve_IntConicConic_1.cxx
IntCurve_IntConicConic_Tool.cxx
IntCurve_IntConicConic_Tool.cxx
IntCurve_IntConicConic_Tool.cxx
IntCurve_ToolPolygon.gxx
IntCurve_IntConicConic_1.hxx
IntCurve_IntConicConic_Tool.hxx

View File

@@ -43,7 +43,6 @@ package IntCurve
-- ProjPCurGen,
-- UserIntConicCurveGen,
-- IntPolyPolyGen,
-- ToolPolygon,
-- Polygon2dGen,
-- DistBetweenPCurvesGen> are Internal
--
@@ -67,11 +66,7 @@ is
generic class Polygon2dGen;
generic class ToolPolygon;
generic class IntPolyPolyGen,ThePolygon2d,
ThePolygon2dTool,
InterferencePoly2d,
TheDistBetweenPCurves,
ExactIntersectionPoint;

View File

@@ -1,7 +1,6 @@
-- File: IntPolyPolyGen.cdl
-- Created: Mon Oct 19 12:03:29 1992
-- Author: Laurent BUCHARD
-- <lbr@sdsun2>
---Copyright: Matra Datavision 1992
@@ -22,23 +21,11 @@ uses Domain from IntRes2d
class ThePolygon2d instantiates Polygon2dGen from IntCurve
(TheCurve,
TheCurveTool);
TheCurveTool);
class ThePolygon2dTool instantiates ToolPolygon from IntCurve
(Pnt2d from gp,
ThePolygon2d,
Box2d from Bnd);
class InterferencePoly2d instantiates InterferencePolygon2d from Intf
(ThePolygon2d,
ThePolygon2dTool,
ThePolygon2d,
ThePolygon2dTool);
class TheDistBetweenPCurves instantiates DistBetweenPCurvesGen
(TheCurve,
TheCurveTool);
TheCurveTool);
class ExactIntersectionPoint

View File

@@ -1,7 +1,6 @@
// File: IntCurve_IntPolyPolyGen.gxx
// Created: Tue Oct 13 11:12:26 1992
// Author: Laurent BUCHARD
// <lbr@sdsun2>
// Modified by skv - Tue Mar 1 14:22:09 2005 OCC8169
@@ -26,6 +25,7 @@
#include <Intf_SectionPoint.hxx>
#include <Intf_SectionLine.hxx>
#include <Intf_TangentZone.hxx>
#include <Intf_InterferencePolygon2d.hxx>
#include <gp_Vec2d.hxx>
@@ -387,7 +387,7 @@ void IntCurve_IntPolyPolyGen::Perform( const TheCurve& C1
Poly1.SetDeflectionOverEstimation(TolConf);
}
IntCurve_InterferencePoly2d InterPP(Poly1);
Intf_InterferencePolygon2d InterPP(Poly1);
IntCurve_ExactIntersectionPoint EIP(C1,C1,TolConf);
Standard_Real U,V;
@@ -843,7 +843,7 @@ void IntCurve_IntPolyPolyGen::Perform( const TheCurve& C1
if(PtrPoly2->DeflectionOverEstimation() < TolConf) {
PtrPoly2->SetDeflectionOverEstimation(TolConf);
}
IntCurve_InterferencePoly2d InterPP(*PtrPoly1,*PtrPoly2);
Intf_InterferencePolygon2d InterPP(*PtrPoly1,*PtrPoly2);
IntCurve_ExactIntersectionPoint EIP(C1,C2,TolConf);
Standard_Real U,V;

View File

@@ -1,7 +1,6 @@
-- File: Polygon2dGen.cdl
-- Created: Mon Oct 19 11:51:16 1992
-- Author: Laurent BUCHARD
-- <lbr@sdsun2>
---Copyright: Matra Datavision 1992
@@ -11,21 +10,20 @@ generic class Polygon2dGen from IntCurve (
---Purpose: Describe a polyline as a topology to compute the
-- interference beetween two polylines 2 dimension.
---Level: Internal
inherits Polygon2d from Intf
uses Pnt2d from gp,
Box2d from Bnd,
Array1OfPnt2d from TColgp,
Array1OfReal from TColStd,
Array1OfInteger from TColStd,
Domain from IntRes2d
Array1OfReal from TColStd,
Array1OfInteger from TColStd,
Domain from IntRes2d
raises OutOfRange from Standard
is
Create (Curve : TheCurve;
@@ -63,17 +61,10 @@ is
-- a polygon inside or near the OtherBox.
is static;
Bounding (me)
returns Box2d from Bnd
is static;
---C++: return const &
---C++: inline
---Purpose: Give the bounding box of the polygon.
DeflectionOverEstimation(me)
returns Real from Standard
---C++: inline
is static;
is redefined virtual;
SetDeflectionOverEstimation(me: in out; x:Real from Standard)
---C++: inline
@@ -83,34 +74,16 @@ is
---C++: inline
is static;
Closed (me)
returns Boolean from Standard
---C++: inline
is static;
NbSegments (me)
returns Integer
---C++: inline
is static;
is redefined virtual;
---Purpose: Give the number of Segments in the polyline.
BeginOfSeg (me;
Index : in Integer)
returns Pnt2d from gp
raises OutOfRange from Standard
is static;
---Purpose: Give the point of range Index in the Polygon.
---C++: inline
---C++: return const &
EndOfSeg (me;
Index : in Integer)
returns Pnt2d from gp
raises OutOfRange from Standard
is static;
---Purpose: Give the point of range Index in the Polygon.
---C++: inline
---C++: return const &
Segment (me; theIndex : in Integer from Standard;
theBegin, theEnd : in out Pnt2d from gp)
raises OutOfRange from Standard is redefined virtual;
---Purpose: Returns the points of the segment <Index> in the Polygon.
-- Implementation :
@@ -165,22 +138,17 @@ is
is static;
fields TheBnd : Box2d from Bnd;
TheDeflection : Real from Standard;
fields TheDeflection : Real from Standard;
NbPntIn : Integer from Standard;
TheMaxNbPoints: Integer from Standard;
TheMaxNbPoints: Integer from Standard;
ThePnts : Array1OfPnt2d from TColgp;
TheParams : Array1OfReal from TColStd;
TheIndex : Array1OfInteger from TColStd;
ClosedPolygon : Boolean from Standard;
TheParams : Array1OfReal from TColStd;
TheIndex : Array1OfInteger from TColStd;
ClosedPolygon : Boolean from Standard;
--- To compute an approximate parameter on the Curve
--
Binf : Real from Standard;
Bsup : Real from Standard;
end Polygon2dGen;

View File

@@ -1,11 +1,9 @@
// File: IntCurve_Polygon2dGen.gxx
// Created: Mon Oct 12 17:17:30 1992
// Author: Laurent BUCHARD
// <lbr@sdsun2>
#define TEST 0
#include <Standard_ConstructionError.hxx>
#include <Bnd_Box2d.hxx>
#include <TColgp_Array1OfPnt2d.hxx>
@@ -14,8 +12,6 @@
#include <gp_Dir2d.hxx>
#define MAJORATION_DEFLECTION 1.5
//======================================================================
//== On echantillonne sur le Domain de la Curve NbPts Points
@@ -57,7 +53,7 @@ IntCurve_Polygon2dGen::IntCurve_Polygon2dGen(const TheCurve& C,
do {
gp_Pnt2d P=TheCurveTool::Value(C,u);
TheBnd.Add(P);
myBox.Add(P);
TheIndex.SetValue(i,i);
ThePnts.SetValue(i,P);
TheParams.SetValue(i,u);
@@ -100,7 +96,7 @@ IntCurve_Polygon2dGen::IntCurve_Polygon2dGen(const TheCurve& C,
}
while(i<NbPts);
TheBnd.Enlarge(TheDeflection*MAJORATION_DEFLECTION);
myBox.Enlarge(TheDeflection*MAJORATION_DEFLECTION);
ClosedPolygon = Standard_False;
}
//======================================================================
@@ -130,7 +126,7 @@ IntCurve_Polygon2dGen::IntCurve_Polygon2dGen(const TheCurve& C,
Standard_Integer i=1;
do {
gp_Pnt2d P=TheCurveTool::Value(C,u);
TheBnd.Add(P);
myBox.Add(P);
ThePnts.SetValue(i,P);
TheParams.SetValue(i,u);
TheIndex.SetValue(i,i);
@@ -171,7 +167,7 @@ IntCurve_Polygon2dGen::IntCurve_Polygon2dGen(const TheCurve& C,
}
while(i<NbPts);
TheBnd.Enlarge(TheDeflection*MAJORATION_DEFLECTION);
myBox.Enlarge(TheDeflection*MAJORATION_DEFLECTION);
ClosedPolygon = Standard_False;
//-------------------------------------------------------
//-- On supprime les points alignes
@@ -209,9 +205,9 @@ IntCurve_Polygon2dGen::IntCurve_Polygon2dGen(const TheCurve& C,
//======================================================================
void IntCurve_Polygon2dGen::ComputeWithBox(const TheCurve& C,
const Bnd_Box2d& BoxOtherPolygon) {
if(TheBnd.IsOut(BoxOtherPolygon)) {
if(myBox.IsOut(BoxOtherPolygon)) {
NbPntIn=2;
TheBnd.SetVoid();
myBox.SetVoid();
}
else {
Standard_Real bx0,bx1,by0,by1;
@@ -264,12 +260,12 @@ void IntCurve_Polygon2dGen::ComputeWithBox(const TheCurve& C,
}
if(nbp==1) {
NbPntIn=2;
TheBnd.SetVoid();
myBox.SetVoid();
}
else {
TheBnd.SetVoid();
myBox.SetVoid();
if(nbp) {
TheBnd.Add(ThePnts.Value(TheIndex.Value(1)));
myBox.Add(ThePnts.Value(TheIndex.Value(1)));
}
Standard_Real RatioDeflection;
Standard_Integer nbpassagedeflection = 0;
@@ -285,7 +281,7 @@ void IntCurve_Polygon2dGen::ComputeWithBox(const TheCurve& C,
Standard_Integer Iim1= TheIndex.Value(i-1);
const gp_Pnt2d& Pi = ThePnts.Value(Ii);
const gp_Pnt2d& Pim1 = ThePnts.Value(Iim1);
TheBnd.Add(Pi);
myBox.Add(Pi);
Standard_Integer Regi = CalculRegion(Pi.X(),Pi.Y(),bx0,bx1,by0,by1);
Standard_Integer Regim1 = CalculRegion(Pim1.X(),Pim1.Y(),bx0,bx1,by0,by1);
if((Regi & Regim1) == 0) {
@@ -346,7 +342,7 @@ void IntCurve_Polygon2dGen::ComputeWithBox(const TheCurve& C,
}
TheDeflection*=MAJORATION_DEFLECTION;
TheBnd.Enlarge(TheDeflection);
myBox.Enlarge(TheDeflection);
}
ClosedPolygon = Standard_False;
Dump();
@@ -403,8 +399,8 @@ extern void DrawSegment(const gp_Pnt2d& _P1,const gp_Pnt2d& _P2);
void IntCurve_Polygon2dGen::Dump(void) const {
if(!DebugPolygon2d) return;
Standard_Real bx0,bx1,by0,by1;
if(TheBnd.IsVoid()) return;
TheBnd.Get(bx0,by0,bx1,by1);
if(myBox.IsVoid()) return;
myBox.Get(bx0,by0,bx1,by1);
DrawSegment(gp_Pnt2d(bx0,by0),gp_Pnt2d(bx1,by0));
DrawSegment(gp_Pnt2d(bx1,by0),gp_Pnt2d(bx1,by1));
DrawSegment(gp_Pnt2d(bx1,by1),gp_Pnt2d(bx0,by1));
@@ -422,11 +418,11 @@ void IntCurve_Polygon2dGen::Dump(void) const {
Standard_Real bx0,bx1,by0,by1;
cout<<"\n ----- Dump de IntCurve_Polygon2dGen -----"<<endl;
if(TheBnd.IsVoid()) {
if(myBox.IsVoid()) {
cout<<" Polygone Vide "<<endl;
return;
}
TheBnd.Get(bx0,by0,bx1,by1);
myBox.Get(bx0,by0,bx1,by1);
cout<<" bx0:"<<bx0 <<endl;
cout<<" by0:"<<by0<<endl;
cout<<" bx1:"<<bx1<<endl;
@@ -441,5 +437,16 @@ void IntCurve_Polygon2dGen::Dump(void) const {
}
#endif
//======================================================================
void IntCurve_Polygon2dGen::Segment(const Standard_Integer theIndex,
gp_Pnt2d &theBegin, gp_Pnt2d &theEnd) const
{
Standard_Integer ind = theIndex;
theBegin = ThePnts(TheIndex(theIndex));
if (theIndex >= NbPntIn) {
if (!ClosedPolygon)
Standard_OutOfRange::Raise("IntCurve_Polygon2dGen::Segment!");
ind = 0;
}
theEnd = ThePnts(TheIndex(ind+1));
}
//======================================================================

View File

@@ -1,14 +1,9 @@
// File: IntCurve_Polygon2dGen.lxx
// Created: Thu 3 Jun 1993
// Author: Laurent BUCHARD
// <lbr@nonox>
#include <Standard_OutOfRange.hxx>
//======================================================================
inline const Bnd_Box2d& IntCurve_Polygon2dGen::Bounding(void) const {
return(TheBnd);
}
//======================================================================
inline Standard_Real IntCurve_Polygon2dGen::DeflectionOverEstimation() const {
return(TheDeflection);
@@ -16,35 +11,17 @@ inline Standard_Real IntCurve_Polygon2dGen::DeflectionOverEstimation() const {
inline void IntCurve_Polygon2dGen::SetDeflectionOverEstimation
(const Standard_Real x) {
TheDeflection = x;
TheBnd.Enlarge(TheDeflection);
myBox.Enlarge(TheDeflection);
}
//======================================================================
inline void IntCurve_Polygon2dGen::Closed(const Standard_Boolean flag) {
ClosedPolygon = flag;
}
//======================================================================
inline Standard_Boolean IntCurve_Polygon2dGen::Closed(void) const {
return(Standard_False); //-- Voir si le cas Closed est traitable
}
//======================================================================
inline Standard_Integer IntCurve_Polygon2dGen::NbSegments(void) const {
return((ClosedPolygon)? NbPntIn : NbPntIn-1);
}
//======================================================================
inline const gp_Pnt2d& IntCurve_Polygon2dGen::EndOfSeg(const Standard_Integer Index) const {
Standard_Integer ind = Index;
if (Index >= NbPntIn) {
if (!ClosedPolygon)
Standard_OutOfRange::Raise("OutOfRange Polygon2d::EndOfSeg !");
ind = 0;
}
return ThePnts(TheIndex(ind+1));
}
//======================================================================
inline const gp_Pnt2d& IntCurve_Polygon2dGen::BeginOfSeg(const Standard_Integer Index) const {
return ThePnts(TheIndex(Index));
}
//======================================================================
inline Standard_Real IntCurve_Polygon2dGen::InfParameter() const {
return(TheParams.Value(TheIndex(1)));
}

View File

@@ -1,58 +0,0 @@
-- File: ToolPolygon.cdl
-- Created: Fri Aug 2 08:18:37 1991
-- Author: Didier PIFFAULT
-- <dpf@sdsun2>
---Copyright: Matra Datavision 1991
generic class ToolPolygon from IntCurve (Point as any;
Polygon as any;
BoundingBox as any)
---Purpose: Describe a polyline as a topology to compute the
-- interference beetween two polylines.
---Level: Internal
raises OutOfRange from Standard
is Bounding (myclass; thePolygon : Polygon)
returns BoundingBox;
---Purpose: Give the bounding box of the polygon.
---C++: inline
---C++: return const &
DeflectionOverEstimation
(myclass; thePolygon : Polygon)
---C++: inline
returns Real from Standard;
Closed (myclass; thePolygon : Polygon)
---C++: inline
returns Boolean from Standard;
NbSegments (myclass; thePolygon : Polygon)
---C++: inline
returns Integer;
---Purpose: Give the number of Segments in the polyline.
BeginOfSeg (myclass; thePolygon : Polygon;
Index : in Integer)
---C++: inline
returns Point
raises OutOfRange from Standard;
---C++: return const &
---Purpose: Give the point of range Index in the Polygon.
EndOfSeg (myclass; thePolygon : Polygon;
Index : in Integer)
---C++: inline
returns Point
raises OutOfRange from Standard;
---C++: return const &
---Purpose: Give the point of range Index in the Polygon.
end ToolPolygon;

View File

@@ -1,5 +0,0 @@
// File: IntCurve_ToolPolygon.gxx
// Created: Tue Jun 4 16:14:49 1996
// Author: Laurent BUCHARD
// <lbr@sherlox.paris1.matra-dtv.fr>

View File

@@ -1,49 +0,0 @@
// File: IntCurve_ToolPolygon.gxx
// Created: Thu Jun 3 14:52:18 1993
// Author: Laurent BUCHARD
// <lbr@nonox>
#include Polygon_hxx
//=================================================================
inline const BoundingBox& IntCurve_ToolPolygon::Bounding
(const Polygon& thePolygon)
{
return thePolygon.Bounding();
}
//=================================================================
inline Standard_Real IntCurve_ToolPolygon::DeflectionOverEstimation
(const Polygon& thePolygon)
{
return thePolygon.DeflectionOverEstimation();
}
//=================================================================
inline Standard_Boolean IntCurve_ToolPolygon::Closed
(const Polygon& thePolygon)
{
return thePolygon.Closed();
}
//=================================================================
inline Standard_Integer IntCurve_ToolPolygon::NbSegments
(const Polygon& thePolygon)
{
return thePolygon.NbSegments();
}
//=================================================================
inline const Point& IntCurve_ToolPolygon::BeginOfSeg
(const Polygon& thePolygon,
const Standard_Integer Index)
{
return thePolygon.BeginOfSeg(Index);
}
//=================================================================
inline const Point& IntCurve_ToolPolygon::EndOfSeg
(const Polygon& thePolygon,
const Standard_Integer Index)
{
return thePolygon.EndOfSeg(Index);
}
//=================================================================