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

0022967: Boolean operations between two cylinders with orthogonal axis generate a shape with big vertex tolerance

This commit is contained in:
PKV
2012-02-10 13:13:27 +00:00
committed by bugmaster
parent 1d37eeb6c1
commit 4f189102e9
32 changed files with 682 additions and 530 deletions

View File

@@ -32,7 +32,8 @@ uses
IntPatch,
IntSurf,
BRepClass3d,
TColgp
TColgp,
MMgt
is
@@ -59,7 +60,6 @@ is
class MarkedRangeSet;
---Purpose: auxiliary class for range management
--modified by NIZHNY-MKK Wed Oct 5 18:08:38 2005.BEGIN
class BaseRangeSample;
---Purpose: base class for range index management
@@ -72,7 +72,6 @@ is
class CurveRangeLocalizeData;
class SurfaceRangeLocalizeData;
--modified by NIZHNY-MKK Wed Oct 5 18:08:43 2005.END
class BeanFaceIntersector;
---Purpose: class provides computing ranges of parameters
@@ -115,7 +114,7 @@ is
---
--- P o i n t e r s
---
pointer PContext to Context from IntTools;
--pointer PContext to Context from IntTools;
---
--- I n s t a n t i a t i o n s
---

View File

@@ -19,7 +19,7 @@ uses
SequenceOfRoots from IntTools,
MarkedRangeSet from IntTools,
SequenceOfRanges from IntTools,
PContext from IntTools,
Context from IntTools,
ExtCS from Extrema,
ProjectPointOnSurf from GeomAPI,
Edge from TopoDS,
@@ -113,11 +113,17 @@ is
--- optimization purposes
---
SetContext(me: in out; theContext: PContext from IntTools);
SetContext(me: in out;
theContext: Context from IntTools);
---Purpose:
--- Sets the context
--- Sets the intersecton context
---
Context(me)
returns Context from IntTools;
---C++: return const &
---Purpose:
--- Gets the intersecton context
---
SetBeanParameters(me: in out;theFirstParOnCurve : Real from Standard;
theLastParOnCurve : Real from Standard);
---Purpose:
@@ -227,7 +233,7 @@ fields
myProjector : ProjectPointOnSurf from GeomAPI;
myRangeManager : MarkedRangeSet from IntTools;
myDeflection : Real from Standard;
myContext : PContext from IntTools;
myContext : Context from IntTools;
-- results
myResults : SequenceOfRanges from IntTools;

View File

@@ -120,7 +120,7 @@ myIsDone(Standard_False)
{
myCriteria = Precision::Confusion();
myCurveResolution = Precision::PConfusion();
myContext = NULL;
}
// ==================================================================================
@@ -140,7 +140,6 @@ myFaceTolerance(0.),
myDeflection(0.01),
myIsDone(Standard_False)
{
myContext = NULL;
Init(theEdge, theFace);
}
@@ -161,7 +160,6 @@ myVMaxParameter(0.),
myDeflection(0.01),
myIsDone(Standard_False)
{
myContext = NULL;
Init(theCurve, theSurface, theBeanTolerance, theFaceTolerance);
}
@@ -197,7 +195,6 @@ myIsDone(Standard_False)
mySurface = theSurface;
myTrsfSurface = Handle(Geom_Surface)::DownCast(mySurface.Surface().Surface()->Transformed(mySurface.Trsf()));
myContext = NULL;
}
// ==================================================================================
@@ -219,7 +216,6 @@ void IntTools_BeanFaceIntersector::Init(const TopoDS_Edge& theEdge,
SetSurfaceParameters(mySurface.FirstUParameter(), mySurface.LastUParameter(),
mySurface.FirstVParameter(), mySurface.LastVParameter());
myResults.Clear();
myContext = NULL;
}
// ==================================================================================
@@ -243,7 +239,6 @@ void IntTools_BeanFaceIntersector::Init(const BRepAdaptor_Curve& theCurve,
SetSurfaceParameters(mySurface.FirstUParameter(), mySurface.LastUParameter(),
mySurface.FirstVParameter(), mySurface.LastVParameter());
myResults.Clear();
myContext = NULL;
}
// ==================================================================================
@@ -264,17 +259,24 @@ void IntTools_BeanFaceIntersector::Init(const BRepAdaptor_Curve& theCurve,
Init(theCurve, theSurface, theBeanTolerance, theFaceTolerance);
SetBeanParameters(theFirstParOnCurve, theLastParOnCurve);
SetSurfaceParameters(theUMinParameter, theUMaxParameter, theVMinParameter, theVMaxParameter);
myContext = NULL;
}
// ==================================================================================
// function: SetContext
// purpose:
// ==================================================================================
void IntTools_BeanFaceIntersector::SetContext(const IntTools_PContext& theContext)
void IntTools_BeanFaceIntersector::SetContext(const Handle(IntTools_Context)& theContext)
{
myContext = theContext;
}
// ==================================================================================
// function: Context
// purpose:
// ==================================================================================
const Handle(IntTools_Context)& IntTools_BeanFaceIntersector::Context()const
{
return myContext;
}
// ==================================================================================
// function: SetBeanParameters
@@ -314,7 +316,11 @@ void IntTools_BeanFaceIntersector::Perform()
Standard_Integer aDiscretization = 30; // corresponds to discretization of BSpline usually approximated by 30 points.
Standard_Real aRelativeDeflection = 0.01;
myDeflection = aRelativeDeflection;
//
if (myContext.IsNull()) {
myContext=new IntTools_Context;
}
//
if(myCurve.GetType()==GeomAbs_Line && mySurface.GetType()==GeomAbs_Plane) {
ComputeLinePlane();
return;
@@ -455,20 +461,11 @@ Standard_Real IntTools_BeanFaceIntersector::Distance(const Standard_Real theArg)
{
gp_Pnt aPoint = myCurve.Value(theArg);
if(myContext == NULL) {
myProjector.Init(aPoint, myTrsfSurface, myUMinParameter, myUMaxParameter,
myVMinParameter, myVMaxParameter, 1.e-10);
if(myProjector.IsDone() && myProjector.NbPoints() > 0) {
return myProjector.LowerDistance();
}
}
else {
GeomAPI_ProjectPointOnSurf& aProjector = myContext->ProjPS(mySurface.Face());
aProjector.Perform(aPoint);
if(aProjector.IsDone() && aProjector.NbPoints() > 0) {
return aProjector.LowerDistance();
}
GeomAPI_ProjectPointOnSurf& aProjector = myContext->ProjPS(mySurface.Face());
aProjector.Perform(aPoint);
if(aProjector.IsDone() && aProjector.NbPoints() > 0) {
return aProjector.LowerDistance();
}
//
Standard_Real aDistance = RealLast();
@@ -530,27 +527,15 @@ Standard_Real IntTools_BeanFaceIntersector::Distance(const Standard_Real theArg,
Standard_Real aDistance = RealLast();
Standard_Boolean projectionfound = Standard_False;
if(myContext == NULL) {
myProjector.Init(aPoint, myTrsfSurface, myUMinParameter, myUMaxParameter,
myVMinParameter, myVMaxParameter, 1.e-10);
if(myProjector.IsDone() && myProjector.NbPoints() > 0) {
myProjector.LowerDistanceParameters(theUParameter, theVParameter);
aDistance = myProjector.LowerDistance();
projectionfound = Standard_True;
}
GeomAPI_ProjectPointOnSurf& aProjector = myContext->ProjPS(mySurface.Face());
aProjector.Perform(aPoint);
if(aProjector.IsDone() && aProjector.NbPoints() > 0) {
aProjector.LowerDistanceParameters(theUParameter, theVParameter);
aDistance = aProjector.LowerDistance();
projectionfound = Standard_True;
}
else {
GeomAPI_ProjectPointOnSurf& aProjector = myContext->ProjPS(mySurface.Face());
aProjector.Perform(aPoint);
if(aProjector.IsDone() && aProjector.NbPoints() > 0) {
aProjector.LowerDistanceParameters(theUParameter, theVParameter);
aDistance = aProjector.LowerDistance();
projectionfound = Standard_True;
}
}
if(!projectionfound) {
//
for(Standard_Integer i = 0; i < 4; i++) {
@@ -1792,7 +1777,7 @@ Standard_Boolean IntTools_BeanFaceIntersector::ComputeLocalized() {
Standard_Real dMinU = 10. * Precision::PConfusion();
Standard_Real dMinV = dMinU;
IntTools_SurfaceRangeLocalizeData aSurfaceDataInit(3, 3, dMinU, dMinV);
IntTools_SurfaceRangeLocalizeData& aSurfaceData = (myContext) ? myContext->SurfaceData(mySurface.Face()) : aSurfaceDataInit;
IntTools_SurfaceRangeLocalizeData& aSurfaceData = myContext->SurfaceData(mySurface.Face());
aSurfaceData.RemoveRangeOutAll();
aSurfaceData.ClearGrid();

View File

@@ -5,7 +5,8 @@
---Copyright: Matra Datavision 2002
class Context from IntTools
class Context from IntTools
inherits TShared from MMgt
---Purpose:
--- The class is to provide direct access
@@ -38,13 +39,12 @@ uses
is
Create
returns Context from IntTools;
---C++: alias "Standard_EXPORT virtual ~IntTools_Context();"
returns mutable Context from IntTools;
---C++: alias "Standard_EXPORT virtual ~IntTools_Context();"
---Purpose:
--- Empty constructor
---
FClass2d(me: in out;
FClass2d(me: mutable;
aF: Face from TopoDS)
returns FClass2d from IntTools;
---C++: return &
@@ -53,7 +53,7 @@ is
--- for given face
---
ProjPS (me: in out;
ProjPS (me: mutable;
aF: Face from TopoDS)
returns ProjectPointOnSurf from GeomAPI;
---C++: return &
@@ -62,7 +62,7 @@ is
--- for given face
---
ProjPC (me: in out;
ProjPC (me: mutable;
aE: Edge from TopoDS)
returns ProjectPointOnCurve from GeomAPI;
---C++: return &
@@ -71,7 +71,7 @@ is
--- for given edge
---
ProjPT (me: in out;
ProjPT (me: mutable;
aC: Curve from Geom)
returns ProjectPointOnCurve from GeomAPI;
---C++: return &
@@ -80,7 +80,7 @@ is
--- for given curve
---
SurfaceData(me: in out;
SurfaceData(me: mutable;
aF: Face from TopoDS)
returns SurfaceRangeLocalizeData from IntTools;
---C++: return &
@@ -89,7 +89,7 @@ is
--- for given face
SolidClassifier(me: in out;
SolidClassifier(me: mutable;
aSolid: Solid from TopoDS)
returns SolidClassifier from BRepClass3d;
---C++: return &
@@ -100,7 +100,7 @@ is
--- API Block
---
ComputeVE (me:out;
ComputeVE (me:mutable;
aV : Vertex from TopoDS;
aE : Edge from TopoDS;
aT :out Real from Standard)
@@ -117,8 +117,7 @@ is
--- 3. projection algorithm failed (-3)
---
--modified by NIZNHY-PKV Tue Feb 2 08:20:43 2010f
ComputeVE (me:out;
ComputeVE (me:mutable;
aV : Vertex from TopoDS;
aE : Edge from TopoDS;
aT :out Real from Standard;
@@ -142,9 +141,8 @@ is
--- vertex tolerance should be modified or not
--- aDist - the value of the distance between the vertex
--- and the edge
--modified by NIZNHY-PKV Tue Feb 2 08:20:55 2010t
ComputeVS (me:out;
ComputeVS (me:mutable;
aV : Vertex from TopoDS;
aF : Face from TopoDS;
U : out Real from Standard;
@@ -161,7 +159,7 @@ is
--- 3. projection point out or on the boundaries of face (-3)
---
StatePointFace(me:out;
StatePointFace(me:mutable;
aF : Face from TopoDS;
aP2D : Pnt2d from gp)
returns State from TopAbs;
@@ -170,7 +168,7 @@ is
--- relative to face aF
---
IsPointInFace(me:out;
IsPointInFace(me:mutable;
aF : Face from TopoDS;
aP2D : Pnt2d from gp)
returns Boolean from Standard;
@@ -180,7 +178,7 @@ is
--- otherwise returns false
---
IsPointInOnFace(me:out;
IsPointInOnFace(me:mutable;
aF : Face from TopoDS;
aP2D : Pnt2d from gp)
returns Boolean from Standard;
@@ -189,7 +187,7 @@ is
--- inside or on the boundaries of aF
---
IsValidPointForFace(me:out;
IsValidPointForFace(me:mutable ;
aP3D : Pnt from gp;
aF : Face from TopoDS;
aTol : Real from Standard)
@@ -201,7 +199,7 @@ is
--- of the face aF
---
IsValidPointForFaces(me:out;
IsValidPointForFaces(me:mutable;
aP3D : Pnt from gp;
aF1 : Face from TopoDS;
aF2 : Face from TopoDS;
@@ -212,7 +210,7 @@ is
--- for both face aF1 and aF2
---
IsValidBlockForFace (me:out;
IsValidBlockForFace (me:mutable;
aT1 : Real from Standard;
aT2 : Real from Standard;
aIC : Curve from IntTools;
@@ -225,7 +223,7 @@ is
--- parameters aT1 and aT2
---
IsValidBlockForFaces (me:out;
IsValidBlockForFaces (me:mutable;
aT1 : Real from Standard;
aT2 : Real from Standard;
aIC : Curve from IntTools;
@@ -238,7 +236,7 @@ is
--- for both faces aF1 and aF2
---
IsVertexOnLine(me:out;
IsVertexOnLine(me:mutable;
aV : Vertex from TopoDS;
aIC : Curve from IntTools;
aTolC: Real from Standard;
@@ -253,7 +251,7 @@ is
--- returns false (in this case aT isn't significant)
---
IsVertexOnLine(me:out;
IsVertexOnLine(me:mutable;
aV : Vertex from TopoDS;
aTolV: Real from Standard;
aIC : Curve from IntTools;
@@ -269,7 +267,7 @@ is
--- returns false (in this case aT isn't significant)
---
ProjectPointOnEdge (me:out;
ProjectPointOnEdge (me:mutable;
aP : Pnt from gp;
aE : Edge from TopoDS;
aT :out Real from Standard)

View File

@@ -39,7 +39,7 @@
//function : ~
//purpose :
//=======================================================================
IntTools_Context::~IntTools_Context()
IntTools_Context::~IntTools_Context()
{
Standard_Address anAdr;
Standard_Integer i, aNb;

View File

@@ -24,8 +24,9 @@ uses
FClass2d from IntTools,
SequenceOfRoots from IntTools,
SequenceOfCommonPrts from IntTools,
PContext from IntTools,
Range from IntTools
Context from IntTools,
Range from IntTools
--raises
is
@@ -87,11 +88,19 @@ is
--- The algorithm processes edge inside these boundaries.
---
SetContext (me: in out; theContext: PContext from IntTools);
SetContext (me: in out;
theContext: Context from IntTools);
---Purpose:
--- Set container of projection algorithms
--- Sets the intersecton context
---
Context (me)
returns Context from IntTools;
---C++:return const &
---Purpose:
--- Gets the intersecton context
---
Perform (me:out);
---Purpose:
--- Launches the process
@@ -241,7 +250,7 @@ fields
myErrorStatus : Integer from Standard;
--- internal members
myContext : PContext from IntTools;
myContext : Context from IntTools;
myProjectableRanges: SequenceOfRanges from IntTools;
myFClass2d : FClass2d from IntTools;
myFuncArray : CArray1OfReal from IntTools;

View File

@@ -86,9 +86,24 @@ static
myErrorStatus=1;
myParallel=Standard_False;
myPar1=0.;
myContext = NULL;
}
//=======================================================================
//function : SetContext
//purpose :
//=======================================================================
void IntTools_EdgeFace::SetContext(const Handle(IntTools_Context)& theContext)
{
myContext = theContext;
}
//=======================================================================
//function : Context
//purpose :
//=======================================================================
const Handle(IntTools_Context)& IntTools_EdgeFace::Context()const
{
return myContext;
}
//=======================================================================
//function : SetEdge
//purpose :
@@ -181,7 +196,7 @@ static
//function : IsDone
//purpose :
//=======================================================================
Standard_Boolean IntTools_EdgeFace::IsDone()const
Standard_Boolean IntTools_EdgeFace::IsDone()const
{
return myIsDone;
}
@@ -189,7 +204,7 @@ static
//function : ErrorStatus
//purpose :
//=======================================================================
Standard_Integer IntTools_EdgeFace::ErrorStatus()const
Standard_Integer IntTools_EdgeFace::ErrorStatus()const
{
return myErrorStatus;
}
@@ -197,7 +212,7 @@ static
//function : CommonParts
//purpose :
//=======================================================================
const IntTools_SequenceOfCommonPrts& IntTools_EdgeFace::CommonParts() const
const IntTools_SequenceOfCommonPrts& IntTools_EdgeFace::CommonParts() const
{
return mySeqOfCommonPrts;
}
@@ -205,7 +220,7 @@ static
//function : Range
//purpose :
//=======================================================================
const IntTools_Range& IntTools_EdgeFace::Range() const
const IntTools_Range& IntTools_EdgeFace::Range() const
{
return myRange;
}
@@ -214,7 +229,7 @@ static
//function : CheckData
//purpose :
//=======================================================================
void IntTools_EdgeFace::CheckData()
void IntTools_EdgeFace::CheckData()
{
if (BRep_Tool::Degenerated(myEdge)) {
myErrorStatus=2;
@@ -223,8 +238,6 @@ static
myErrorStatus=3;
}
}
//=======================================================================
//function : Prepare
//purpose :
@@ -403,22 +416,12 @@ static
//
Standard_Real ULD, VLD;
if(myContext == NULL) {
aProjector.Init(P, GS, Umin, Usup, Vmin, Vsup, myEpsT);
bFlag=aProjector.IsDone();
if(bFlag) {
aProjector.LowerDistanceParameters(ULD, VLD);
}
}
else {
GeomAPI_ProjectPointOnSurf& aLocProj = myContext->ProjPS(myFace);
aLocProj.Perform(P);
bFlag = aLocProj.IsDone();
if(bFlag) {
aLocProj.LowerDistanceParameters(ULD, VLD);
}
GeomAPI_ProjectPointOnSurf& aLocProj = myContext->ProjPS(myFace);
aLocProj.Perform(P);
bFlag = aLocProj.IsDone();
if(bFlag) {
aLocProj.LowerDistanceParameters(ULD, VLD);
}
//
@@ -429,12 +432,7 @@ static
TopAbs_State aState;
gp_Pnt2d aP2d(ULD, VLD);
if(myContext == NULL) {
aState=myFClass2d.Perform(aP2d);
}
else {
aState = myContext->FClass2d(myFace).Perform(aP2d);
}
aState = myContext->FClass2d(myFace).Perform(aP2d);
//
if (aState==TopAbs_IN || aState==TopAbs_ON) {
@@ -473,23 +471,12 @@ static
//
Standard_Boolean bFlag = Standard_False;
if(myContext == NULL) {
GeomAPI_ProjectPointOnSurf aProjector;
aProjector.Init(P, GS, Umin, Usup, Vmin, Vsup, myEpsT);
bFlag=aProjector.IsDone();
if(bFlag) {
aD=aProjector.LowerDistance();
}
}
else {
GeomAPI_ProjectPointOnSurf& aLocProj = myContext->ProjPS(myFace);
aLocProj.Perform(P);
bFlag = aLocProj.IsDone();
if(bFlag) {
aD = aLocProj.LowerDistance();
}
GeomAPI_ProjectPointOnSurf& aLocProj = myContext->ProjPS(myFace);
aLocProj.Perform(P);
bFlag = aLocProj.IsDone();
if(bFlag) {
aD = aLocProj.LowerDistance();
}
//
@@ -1253,14 +1240,6 @@ static
return theflag;
}
//=======================================================================
//function : SetContext
//purpose :
//=======================================================================
void IntTools_EdgeFace::SetContext(const IntTools_PContext& theContext)
{
myContext = theContext;
}
//=======================================================================
//function : Perform
@@ -1270,17 +1249,19 @@ static
{
Standard_Integer i, aNb;
IntTools_CommonPrt aCommonPrt;
//IntTools_Root aRoot; // Wng in Gcc 3.0
//...
aCommonPrt.SetEdge1(myEdge);
//
aCommonPrt.SetEdge1(myEdge);
//
myErrorStatus=0;
CheckData();
if (myErrorStatus)
if (myErrorStatus) {
return;
}
//
if (myContext.IsNull()) {
myContext=new IntTools_Context;
}
//
myIsDone = Standard_False;
myC.Initialize(myEdge);
GeomAbs_CurveType aCurveType;
@@ -1307,7 +1288,7 @@ static
myS.Initialize (myFace,Standard_True);
if(myContext == NULL) {
if(myContext.IsNull()) {
myFClass2d.Init(myFace, 1.e-6);
}

View File

@@ -9,23 +9,25 @@ class FaceFace from IntTools
---Purpose: This class provides the intersection of
--- face's underlying surfaces.
uses
uses
TopolTool from Adaptor3d,
HSurface from GeomAdaptor,
ListOfPntOn2S from IntSurf ,
Intersection from IntPatch,
Face from TopoDS,
SequenceOfCurves from IntTools,
Intersection from IntPatch,
LineConstructor from IntTools,
HSurface from GeomAdaptor,
TopolTool from Adaptor3d,
SequenceOfPntOn2Faces from IntTools,
--amv
ListOfPntOn2S from IntSurf
SequenceOfPntOn2Faces from IntTools,
Context from IntTools
raises NotDone from StdFail
is
Create
returns FaceFace from IntTools;
returns FaceFace from IntTools;
---Purpose:
--- Empty constructor.
---
@@ -102,10 +104,8 @@ is
---Purpose:
--- Returns True if faces are tangent
---
--modified by NIZNHY-PKV Fri Sep 16 07:44:22 2011
PrepareLines3D (me:out;
bToSplit: Boolean from Standard=Standard_True);
--PrepareLines3D (me:out);
---Purpose:
--- Provides post-processing the result lines.
--- <bToSplit> - the flag.
@@ -113,7 +113,8 @@ is
-- on parts.
-- In case of <bToSplit> is false the closed 3D-curves remain untouched.
SetList (me: in out; ListOfPnts: in out ListOfPntOn2S from IntSurf);
SetList (me: in out;
ListOfPnts: in out ListOfPntOn2S from IntSurf);
----------------------------------------------------------
-- private block
@@ -125,7 +126,18 @@ is
ComputeTolReached3d(me:out)
is protected;
SetContext(me:out;
aContext : Context from IntTools);
---Purpose:
--- Sets the intersecton context
Context(me)
returns Context from IntTools;
---C++: return const &
---Purpose:
--- Gets the intersecton context
---
fields
myIsDone : Boolean from Standard;
@@ -150,8 +162,11 @@ fields
myFace2 : Face from TopoDS;
myPnts : SequenceOfPntOn2Faces from IntTools;
--amv
myListOfPnts : ListOfPntOn2S from IntSurf;
myListOfPnts : ListOfPntOn2S from IntSurf;
--modified by NIZNHY-PKV Tue Jan 31 08:27:18 2012f
myContext : Context from IntTools;
--modified by NIZNHY-PKV Tue Jan 31 08:27:21 2012t
end FaceFace from IntTools;

View File

@@ -108,10 +108,9 @@
#include <IntTools_Context.hxx>
#include <IntSurf_ListIteratorOfListOfPntOn2S.hxx>
//modified by NIZNHY-PKV Mon Dec 26 13:37:52 2011f
static
void RefineVector(gp_Vec2d& aV2D);
//modified by NIZNHY-PKV Mon Dec 26 13:37:54 2011t
static
void DumpWLine(const Handle(IntPatch_WLine)& aWLine);
//
@@ -179,7 +178,8 @@ static
const IntTools_LineConstructor& theLConstructor,
const Standard_Boolean theAvoidLConstructor,
IntPatch_SequenceOfLine& theNewLines,
Standard_Real& theReachedTol3d);
Standard_Real& theReachedTol3d,
const Handle(IntTools_Context)& );
static
Standard_Boolean ParameterOutOfBoundary(const Standard_Real theParameter,
@@ -188,7 +188,8 @@ static
const TopoDS_Face& theFace2,
const Standard_Real theOtherParameter,
const Standard_Boolean bIncreasePar,
Standard_Real& theNewParameter);
Standard_Real& theNewParameter,
const Handle(IntTools_Context)& );
static
Standard_Boolean IsCurveValid(Handle(Geom2d_Curve)& thePCurve);
@@ -216,7 +217,8 @@ static
const TopoDS_Face& theFace2,
Handle(TColgp_HArray1OfPnt2d)& theResultOnS1,
Handle(TColgp_HArray1OfPnt2d)& theResultOnS2,
Handle(TColStd_HArray1OfReal)& theResultRadius);
Handle(TColStd_HArray1OfReal)& theResultRadius,
const Handle(IntTools_Context)& );
static
Standard_Boolean FindPoint(const gp_Pnt2d& theFirstPoint,
@@ -237,12 +239,12 @@ static
Handle(GeomAdaptor_HSurface) theGASurface);
static
gp_Pnt2d AdjustByNeighbour(const gp_Pnt2d& theaNeighbourPoint,
const gp_Pnt2d& theOriginalPoint,
Handle(GeomAdaptor_HSurface) theGASurface);
gp_Pnt2d AdjustByNeighbour(const gp_Pnt2d& theaNeighbourPoint,
const gp_Pnt2d& theOriginalPoint,
Handle(GeomAdaptor_HSurface) theGASurface);
static
Standard_Boolean ApproxWithPCurves(const gp_Cylinder& theCyl,
const gp_Sphere& theSph);
Standard_Boolean ApproxWithPCurves(const gp_Cylinder& theCyl,
const gp_Sphere& theSph);
static void PerformPlanes(const Handle(GeomAdaptor_HSurface)& theS1,
const Handle(GeomAdaptor_HSurface)& theS2,
@@ -263,6 +265,7 @@ static
void ApproxParameters(const Handle(GeomAdaptor_HSurface)& aHS1,
const Handle(GeomAdaptor_HSurface)& aHS2,
Standard_Integer& iDegMin,
Standard_Integer& iNbIter,
Standard_Integer& iDegMax);
static
@@ -279,12 +282,25 @@ static
static
Standard_Integer IndexType(const GeomAbs_SurfaceType aType);
//
//modified by NIZNHY-PKV Tue Jan 31 08:02:24 2012f
static
Standard_Real MaxSquareDistance (const Standard_Real aT,
const Handle(Geom_Curve)& aC3D,
const Handle(Geom2d_Curve)& aC2D1,
const Handle(Geom2d_Curve)& aC2D2,
const Handle(GeomAdaptor_HSurface) myHS1,
const Handle(GeomAdaptor_HSurface) myHS2,
const TopoDS_Face& aF1,
const TopoDS_Face& aF2,
const Handle(IntTools_Context)& aCtx);
//modified by NIZNHY-PKV Tue Jan 31 08:02:28 2012t
//
//=======================================================================
//function :
//purpose :
//=======================================================================
IntTools_FaceFace::IntTools_FaceFace()
IntTools_FaceFace::IntTools_FaceFace()
{
myTangentFaces=Standard_False;
//
@@ -293,30 +309,45 @@ static
myTolReached2d=0.;
myTolReached3d=0.;
SetParameters(Standard_True, Standard_True, Standard_True, 1.e-07);
}
//=======================================================================
//function : SetContext
//purpose :
//=======================================================================
void IntTools_FaceFace::SetContext(const Handle(IntTools_Context)& aContext)
{
myContext=aContext;
}
//=======================================================================
//function : Context
//purpose :
//=======================================================================
const Handle(IntTools_Context)& IntTools_FaceFace::Context()const
{
return myContext;
}
//=======================================================================
//function : Face1
//purpose :
//=======================================================================
const TopoDS_Face& IntTools_FaceFace::Face1() const
const TopoDS_Face& IntTools_FaceFace::Face1() const
{
return myFace1;
}
//=======================================================================
//function : Face2
//purpose :
//=======================================================================
const TopoDS_Face& IntTools_FaceFace::Face2() const
const TopoDS_Face& IntTools_FaceFace::Face2() const
{
return myFace2;
}
//=======================================================================
//function : TangentFaces
//purpose :
//=======================================================================
Standard_Boolean IntTools_FaceFace::TangentFaces() const
Standard_Boolean IntTools_FaceFace::TangentFaces() const
{
return myTangentFaces;
}
@@ -324,7 +355,7 @@ static
//function : Points
//purpose :
//=======================================================================
const IntTools_SequenceOfPntOn2Faces& IntTools_FaceFace::Points() const
const IntTools_SequenceOfPntOn2Faces& IntTools_FaceFace::Points() const
{
return myPnts;
}
@@ -332,7 +363,7 @@ static
//function : IsDone
//purpose :
//=======================================================================
Standard_Boolean IntTools_FaceFace::IsDone() const
Standard_Boolean IntTools_FaceFace::IsDone() const
{
return myIsDone;
}
@@ -340,7 +371,7 @@ static
//function : TolReached3d
//purpose :
//=======================================================================
Standard_Real IntTools_FaceFace::TolReached3d() const
Standard_Real IntTools_FaceFace::TolReached3d() const
{
return myTolReached3d;
}
@@ -348,18 +379,18 @@ static
//function : Lines
//purpose : return lines of intersection
//=======================================================================
const IntTools_SequenceOfCurves& IntTools_FaceFace::Lines() const
const IntTools_SequenceOfCurves& IntTools_FaceFace::Lines() const
{
StdFail_NotDone_Raise_if(!myIsDone,
"IntTools_FaceFace::Lines() => !myIntersector.IsDone()");
StdFail_NotDone_Raise_if
(!myIsDone,
"IntTools_FaceFace::Lines() => !myIntersector.IsDone()");
return mySeqOfCurve;
}
//=======================================================================
//function : TolReached2d
//purpose :
//=======================================================================
Standard_Real IntTools_FaceFace::TolReached2d() const
Standard_Real IntTools_FaceFace::TolReached2d() const
{
return myTolReached2d;
}
@@ -367,10 +398,10 @@ static
// function: SetParameters
//
// =======================================================================
void IntTools_FaceFace::SetParameters(const Standard_Boolean ToApproxC3d,
const Standard_Boolean ToApproxC2dOnS1,
const Standard_Boolean ToApproxC2dOnS2,
const Standard_Real ApproximationTolerance)
void IntTools_FaceFace::SetParameters(const Standard_Boolean ToApproxC3d,
const Standard_Boolean ToApproxC2dOnS1,
const Standard_Boolean ToApproxC2dOnS2,
const Standard_Real ApproximationTolerance)
{
myApprox = ToApproxC3d;
myApprox1 = ToApproxC2dOnS1;
@@ -381,12 +412,10 @@ static
//function : SetList
//purpose :
//=======================================================================
void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
{
myListOfPnts = aListOfPnts;
}
//=======================================================================
//function : Perform
//purpose : intersect surfaces of the faces
@@ -404,6 +433,10 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
Handle(IntTools_TopolTool) dom1, dom2;
BRepAdaptor_Surface aBAS1, aBAS2;
//
if (myContext.IsNull()) {
myContext=new IntTools_Context;
}
//
mySeqOfCurve.Clear();
myTolReached2d=0.;
myTolReached3d=0.;
@@ -463,38 +496,35 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
mySeqOfCurve, myTangentFaces);
myIsDone = Standard_True;
if(myTangentFaces) {
return;
}
//
NbLinPP = mySeqOfCurve.Length();
if(NbLinPP == 0) {
return;
}
Standard_Real aTolFMax;
//
myTolReached3d = 1.e-7;
//
aTolFMax=Max(aTolF1, aTolF2);
//
if (aTolFMax>myTolReached3d) {
myTolReached3d=aTolFMax;
}
myTolReached2d = myTolReached3d;
//
if (bReverse) {
Handle(Geom2d_Curve) aC2D1, aC2D2;
if(!myTangentFaces) {
//
aNbLin=mySeqOfCurve.Length();
for (i=1; i<=aNbLin; ++i) {
IntTools_Curve& aIC=mySeqOfCurve(i);
aC2D1=aIC.FirstCurve2d();
aC2D2=aIC.SecondCurve2d();
NbLinPP = mySeqOfCurve.Length();
if(NbLinPP) {
Standard_Real aTolFMax;
//
aIC.SetFirstCurve2d(aC2D2);
aIC.SetSecondCurve2d(aC2D1);
myTolReached3d = 1.e-7;
//
aTolFMax=Max(aTolF1, aTolF2);
//
if (aTolFMax>myTolReached3d) {
myTolReached3d=aTolFMax;
}
myTolReached2d = myTolReached3d;
//
if (bReverse) {
Handle(Geom2d_Curve) aC2D1, aC2D2;
//
aNbLin=mySeqOfCurve.Length();
for (i=1; i<=aNbLin; ++i) {
IntTools_Curve& aIC=mySeqOfCurve(i);
aC2D1=aIC.FirstCurve2d();
aC2D2=aIC.SecondCurve2d();
//
aIC.SetFirstCurve2d(aC2D2);
aIC.SetSecondCurve2d(aC2D1);
}
}
}
}
return;
@@ -689,39 +719,85 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
GeomAbs_SurfaceType aType1, aType2;
//
aNbLin=myIntersector.NbLines();
//
aType1=myHS1->Surface().GetType();
aType2=myHS2->Surface().GetType();
//
if (aNbLin==2 &&
aType1==GeomAbs_Cylinder &&
aType2==GeomAbs_Cylinder) {
Handle(IntPatch_Line) aIL1, aIL2;
IntPatch_IType aTL1, aTL2;
//
aIL1=myIntersector.Line(1);
aIL2=myIntersector.Line(2);
aTL1=aIL1->ArcType();
aTL2=aIL2->ArcType();
if (aTL1==IntPatch_Lin && aTL2==IntPatch_Lin) {
Standard_Real aD, aDTresh, dTol;
gp_Lin aL1, aL2;
if (aType1==GeomAbs_Cylinder && aType2==GeomAbs_Cylinder) {
if (aNbLin==2){
Handle(IntPatch_Line) aIL1, aIL2;
IntPatch_IType aTL1, aTL2;
//
dTol=1.e-8;
aDTresh=1.5e-6;
//
aL1=Handle(IntPatch_GLine)::DownCast(aIL1)->Line();
aL2=Handle(IntPatch_GLine)::DownCast(aIL2)->Line();
aD=aL1.Distance(aL2);
aD=0.5*aD;
if (aD<aDTresh) {
myTolReached3d=aD+dTol;
aIL1=myIntersector.Line(1);
aIL2=myIntersector.Line(2);
aTL1=aIL1->ArcType();
aTL2=aIL2->ArcType();
if (aTL1==IntPatch_Lin && aTL2==IntPatch_Lin) {
Standard_Real aD, aDTresh, dTol;
gp_Lin aL1, aL2;
//
dTol=1.e-8;
aDTresh=1.5e-6;
//
aL1=Handle(IntPatch_GLine)::DownCast(aIL1)->Line();
aL2=Handle(IntPatch_GLine)::DownCast(aIL2)->Line();
aD=aL1.Distance(aL2);
aD=0.5*aD;
if (aD<aDTresh) {
myTolReached3d=aD+dTol;
}
return;
}
}
}
//ZZ
{// Check the distances
Standard_Boolean bIsDone;
Standard_Integer i, j, aNbP;
Standard_Real aT, aT1, aT2, dT, aD2, aD2Max;
//
aD2Max=0.;
aNbP=11;
aNbLin=mySeqOfCurve.Length();
//
for (i=1; i<=aNbLin; ++i) {
const IntTools_Curve& aIC=mySeqOfCurve(i);
const Handle(Geom_Curve)& aC3D=aIC.Curve();
const Handle(Geom2d_Curve)& aC2D1=aIC.FirstCurve2d();
const Handle(Geom2d_Curve)& aC2D2=aIC.SecondCurve2d();
//
if (aC3D.IsNull()) {
continue;
}
const Handle(Geom_BSplineCurve)& aBC=
Handle(Geom_BSplineCurve)::DownCast(aC3D);
if (aBC.IsNull()) {
continue;
}
//
aT1=aBC->FirstParameter();
aT2=aBC->LastParameter();
//
dT=(aT2-aT1)/(aNbP-1);
for (j=0; j<aNbP; ++j) {
aT=aT1+j*dT;
if (j==aNbP-1) {
aT=aT2;
}
aD2=MaxSquareDistance(aT, aC3D, aC2D1, aC2D2,
myHS1, myHS2, myFace1, myFace2, myContext);
if (aD2>aD2Max) {
aD2Max=aD2;
}
}//for (j=0; j<aNbP; ++j) {
}//for (i=1; i<=aNbLin; ++i) {
//
myTolReached3d=sqrt(aD2Max);
}
}// if (aType1==GeomAbs_Cylinder && aType2==GeomAbs_Cylinder) {
//
//904/G3 f
if (aType1==GeomAbs_Plane &&
aType2==GeomAbs_Plane) {
else if (aType1==GeomAbs_Plane && aType2==GeomAbs_Plane) {
Standard_Real aTolF1, aTolF2, aTolFMax, aTolTresh;
//
aTolTresh=1.e-7;
@@ -733,11 +809,11 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
if (aTolFMax>aTolTresh) {
myTolReached3d=aTolFMax;
}
}
}//if (aType1==GeomAbs_Plane && aType2==GeomAbs_Plane) {
//t
//IFV Bug OCC20297
if((aType1 == GeomAbs_Cylinder && aType2 == GeomAbs_Plane) ||
(aType2 == GeomAbs_Cylinder && aType1 == GeomAbs_Plane)) {
else if((aType1 == GeomAbs_Cylinder && aType2 == GeomAbs_Plane) ||
(aType2 == GeomAbs_Cylinder && aType1 == GeomAbs_Plane)) {
if(aNbLin == 1) {
const Handle(IntPatch_Line)& aIL1 = myIntersector.Line(1);
if(aIL1->ArcType() == IntPatch_Circle) {
@@ -766,11 +842,11 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
}
} //aIL1->ArcType() == IntPatch_Circle
} //aNbLin == 1
} // aType1 == GeomAbs_Cylinder && aType2 == GeomAbs_Plane) ...
} // aType1 == GeomAbs_Cylinder && aType2 == GeomAbs_Plane)
//End IFV Bug OCC20297
//
if ((aType1==GeomAbs_Plane && aType2==GeomAbs_Torus) ||
(aType2==GeomAbs_Plane && aType1==GeomAbs_Torus)) {
else if ((aType1==GeomAbs_Plane && aType2==GeomAbs_Torus) ||
(aType2==GeomAbs_Plane && aType1==GeomAbs_Torus)) {
aNbLin=mySeqOfCurve.Length();
if (aNbLin!=1) {
return;
@@ -785,7 +861,8 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
//
const IntTools_Curve& aIC=mySeqOfCurve(1);
const Handle(Geom_Curve)& aC3D=aIC.Curve();
const Handle(Geom_BSplineCurve)& aBS=Handle(Geom_BSplineCurve)::DownCast(aC3D);
const Handle(Geom_BSplineCurve)& aBS=
Handle(Geom_BSplineCurve)::DownCast(aC3D);
if (aBS.IsNull()) {
return;
}
@@ -828,18 +905,13 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
}
}// if ((aType1==GeomAbs_Plane && aType2==GeomAbs_Torus) ||
//
if ((aType1==GeomAbs_SurfaceOfRevolution && aType2==GeomAbs_Cylinder) ||
(aType2==GeomAbs_SurfaceOfRevolution && aType1==GeomAbs_Cylinder)) {
Standard_Boolean bIsDone;
else if ((aType1==GeomAbs_SurfaceOfRevolution && aType2==GeomAbs_Cylinder) ||
(aType2==GeomAbs_SurfaceOfRevolution && aType1==GeomAbs_Cylinder)) {
Standard_Integer i, j, aNbP;
Standard_Real aT, aT1, aT2, dT, aU1, aV1, aU2, aV2;
Standard_Real aDSmax, aDS1, aDS2, aDS;
gp_Pnt2d aP2D1, aP2D2;
gp_Pnt aP3D, aP3D1, aP3D2;
IntTools_Context aCtx;
Standard_Real aT, aT1, aT2, dT, aD2max, aD2;
//
aNbLin=mySeqOfCurve.Length();
aDSmax=-1.;
aD2max=0.;
aNbP=11;
//
for (i=1; i<=aNbLin; ++i) {
@@ -851,7 +923,8 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
if (aC3D.IsNull()) {
continue;
}
const Handle(Geom_BSplineCurve)& aBC=Handle(Geom_BSplineCurve)::DownCast(aC3D);
const Handle(Geom_BSplineCurve)& aBC=
Handle(Geom_BSplineCurve)::DownCast(aC3D);
if (aBC.IsNull()) {
return;
}
@@ -866,57 +939,17 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
aT=aT2;
}
//
aC3D->D0(aT, aP3D);
// 1
if (!aC2D1.IsNull()) {
aC2D1->D0(aT, aP2D1);
aP2D1.Coord(aU1, aV1);
myHS1->D0(aU1, aV1, aP3D1);
aDS1=aP3D.SquareDistance(aP3D1);
if (aDS1>aDSmax) {
aDSmax=aDS1;
}
}
// 2
if (!aC2D2.IsNull()) {
aC2D2->D0(aT, aP2D2);
aP2D2.Coord(aU2, aV2);
myHS2->D0(aU2, aV2, aP3D2);
aDS2=aP3D.SquareDistance(aP3D2);
if (aDS2>aDSmax) {
aDSmax=aDS2;
}
}
// 3
GeomAPI_ProjectPointOnSurf& aPPS1=aCtx.ProjPS(myFace1);
aPPS1.Perform(aP3D);
bIsDone=aPPS1.IsDone();
if (bIsDone) {
aPPS1.LowerDistanceParameters(aU1, aV1);
myHS1->D0(aU1, aV1, aP3D1);
aDS1=aP3D.SquareDistance(aP3D1);
if (aDS1>aDSmax) {
aDSmax=aDS1;
}
}
// 4
GeomAPI_ProjectPointOnSurf& aPPS2=aCtx.ProjPS(myFace2);
aPPS2.Perform(aP3D);
bIsDone=aPPS2.IsDone();
if (bIsDone) {
aPPS2.LowerDistanceParameters(aU2, aV2);
myHS2->D0(aU2, aV2, aP3D2);
aDS2=aP3D.SquareDistance(aP3D2);
if (aDS2>aDSmax) {
aDSmax=aDS2;
}
aD2=MaxSquareDistance(aT, aC3D, aC2D1, aC2D2,
myHS1, myHS2, myFace1, myFace2, myContext);
if (aD2>aD2max) {
aD2max=aD2;
}
}//for (j=0; j<aNbP; ++j) {
}//for (i=1; i<=aNbLin; ++i) {
//
aDS=myTolReached3d*myTolReached3d;
if (aDSmax > aDS) {
myTolReached3d=sqrt(aDSmax);
aD2=myTolReached3d*myTolReached3d;
if (aD2max > aD2) {
myTolReached3d=sqrt(aD2max);
}
}//if((aType1==GeomAbs_SurfaceOfRevolution ...
}
@@ -955,12 +988,22 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
//
const Handle(IntPatch_WLine)& aWLine=
Handle(IntPatch_WLine)::DownCast(L);
//
//DEBf
//DumpWLine(aWLine);
//DEBt
anewL = ComputePurgedWLine(aWLine);
if(anewL.IsNull()) {
return;
}
L = anewL;
//DEBf
/*
{ const Handle(IntPatch_WLine)& aWLineX=
Handle(IntPatch_WLine)::DownCast(L);
DumpWLine(aWLineX);
}
*/
//DEBt
//
if(!myListOfPnts.IsEmpty()) {
bAvoidLineConstructor = Standard_True;
@@ -1158,7 +1201,7 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
if(P1.Distance(P2) > aTolDist) {
Standard_Real anewpar = fprm;
if(ParameterOutOfBoundary(fprm, newc, myFace1, myFace2, lprm, Standard_False, anewpar)) {
if(ParameterOutOfBoundary(fprm, newc, myFace1, myFace2, lprm, Standard_False, anewpar, myContext)) {
fprm = anewpar;
}
aSeqFprm.Append(fprm);
@@ -1180,7 +1223,7 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
if(P1.Distance(P2) > aTolDist) {
Standard_Real anewpar = lprm;
if(ParameterOutOfBoundary(lprm, newc, myFace1, myFace2, fprm, Standard_True, anewpar)) {
if(ParameterOutOfBoundary(lprm, newc, myFace1, myFace2, fprm, Standard_True, anewpar, myContext)) {
lprm = anewpar;
}
aSeqFprm.Append(aNul);
@@ -1618,10 +1661,15 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
if(reApprox && !rejectSurface)
theapp3d.SetParameters(myTolApprox, tol2d, 4, 8, 0, Standard_False, aParType);
else {
Standard_Integer iDegMax, iDegMin;
Standard_Integer iDegMax, iDegMin, iNbIter;
//
ApproxParameters(myHS1, myHS2, iDegMin, iDegMax);
theapp3d.SetParameters(myTolApprox, tol2d, iDegMin, iDegMax, 0, Standard_True, aParType);
//modified by NIZNHY-PKV Mon Jan 30 14:19:32 2012f
ApproxParameters(myHS1, myHS2, iDegMin, iDegMax, iNbIter);
theapp3d.SetParameters(myTolApprox, tol2d, iDegMin, iDegMax, iNbIter, Standard_True, aParType);
//
// ApproxParameters(myHS1, myHS2, iDegMin, iDegMax);
// theapp3d.SetParameters(myTolApprox, tol2d, iDegMin, iDegMax, 0, Standard_True, aParType);
//modified by NIZNHY-PKV Mon Jan 30 14:19:35 2012t
}
}
//
@@ -1634,7 +1682,8 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
myLConstruct,
bAvoidLineConstructor,
aSeqOfL,
aReachedTol);
aReachedTol,
myContext);
if ( bIsDecomposited && ( myTolReached3d < aReachedTol ) )
myTolReached3d = aReachedTol;
@@ -2897,9 +2946,7 @@ Standard_Boolean FindPoint(const gp_Pnt2d& theFirstPoint,
}
gp_Vec2d anormvec = aVec;
anormvec.Normalize();
//modified by NIZNHY-PKV Mon Dec 19 11:46:06 2011f
RefineVector(anormvec);
//modified by NIZNHY-PKV Mon Dec 19 11:46:10 2011t
Standard_Real adot1 = anormvec.Dot(anOtherVecNormal);
if(fabs(adot1) < Precision::Angular())
@@ -3044,8 +3091,6 @@ Standard_Boolean CheckTangentZonesExist( const Handle(GeomAdaptor_HSurface)& the
( theSurface2->GetType() != GeomAbs_Torus ) )
return Standard_False;
IntTools_Context aContext;
gp_Torus aTor1 = theSurface1->Torus();
gp_Torus aTor2 = theSurface2->Torus();
@@ -3072,12 +3117,13 @@ Standard_Integer ComputeTangentZones( const Handle(GeomAdaptor_HSurface)& theSur
const TopoDS_Face& theFace2,
Handle(TColgp_HArray1OfPnt2d)& theResultOnS1,
Handle(TColgp_HArray1OfPnt2d)& theResultOnS2,
Handle(TColStd_HArray1OfReal)& theResultRadius) {
Handle(TColStd_HArray1OfReal)& theResultRadius,
const Handle(IntTools_Context)& aContext)
{
Standard_Integer aResult = 0;
if ( !CheckTangentZonesExist( theSurface1, theSurface2 ) )
return aResult;
IntTools_Context aContext;
TColgp_SequenceOfPnt2d aSeqResultS1, aSeqResultS2;
TColStd_SequenceOfReal aSeqResultRad;
@@ -3151,7 +3197,8 @@ Standard_Integer ComputeTangentZones( const Handle(GeomAdaptor_HSurface)& theSur
Standard_Integer surfit = 0;
for ( surfit = 0; surfit < 2; surfit++ ) {
GeomAPI_ProjectPointOnSurf& aProjector = (surfit == 0) ? aContext.ProjPS(theFace1) : aContext.ProjPS(theFace2);
GeomAPI_ProjectPointOnSurf& aProjector =
(surfit == 0) ? aContext->ProjPS(theFace1) : aContext->ProjPS(theFace2);
gp_Pnt aP3d = (surfit == 0) ? P1.Value() : P2.Value();
aProjector.Perform(aP3d);
@@ -3282,7 +3329,9 @@ Standard_Boolean DecompositionOfWLine(const Handle(IntPatch_WLine)& theWLine,
const IntTools_LineConstructor& theLConstructor,
const Standard_Boolean theAvoidLConstructor,
IntPatch_SequenceOfLine& theNewLines,
Standard_Real& theReachedTol3d) {
Standard_Real& theReachedTol3d,
const Handle(IntTools_Context)& aContext)
{
Standard_Boolean bRet, bAvoidLineConstructor;
Standard_Integer aNbPnts, aNbParts;
@@ -3307,13 +3356,12 @@ Standard_Boolean DecompositionOfWLine(const Handle(IntPatch_WLine)& theWLine,
TColStd_Array1OfListOfInteger anArrayOfLines(1, aNbPnts);
TColStd_Array1OfInteger anArrayOfLineType(1, aNbPnts);
TColStd_ListOfInteger aListOfPointIndex;
IntTools_Context aContext;
Handle(TColgp_HArray1OfPnt2d) aTanZoneS1;
Handle(TColgp_HArray1OfPnt2d) aTanZoneS2;
Handle(TColStd_HArray1OfReal) aTanZoneRadius;
Standard_Integer aNbZone = ComputeTangentZones( theSurface1, theSurface2, theFace1, theFace2,
aTanZoneS1, aTanZoneS2, aTanZoneRadius );
aTanZoneS1, aTanZoneS2, aTanZoneRadius, aContext);
//
nblines=0;
@@ -3751,7 +3799,8 @@ Standard_Boolean DecompositionOfWLine(const Handle(IntPatch_WLine)& theWLine,
if(found) {
// check point
Standard_Real aCriteria = BRep_Tool::Tolerance(theFace1) + BRep_Tool::Tolerance(theFace2);
GeomAPI_ProjectPointOnSurf& aProjector = (surfit == 0) ? aContext.ProjPS(theFace2) : aContext.ProjPS(theFace1);
GeomAPI_ProjectPointOnSurf& aProjector =
(surfit == 0) ? aContext->ProjPS(theFace2) : aContext->ProjPS(theFace1);
Handle(GeomAdaptor_HSurface) aSurface = (surfit == 0) ? theSurface1 : theSurface2;
Handle(GeomAdaptor_HSurface) aSurfaceOther = (surfit == 0) ? theSurface2 : theSurface1;
@@ -3787,7 +3836,8 @@ Standard_Boolean DecompositionOfWLine(const Handle(IntPatch_WLine)& theWLine,
foundV = ( foundV < vmin ) ? vmin : foundV;
foundV = ( foundV > vmax ) ? vmax : foundV;
GeomAPI_ProjectPointOnSurf& aProjector2 = (surfit == 0) ? aContext.ProjPS(theFace1) : aContext.ProjPS(theFace2);
GeomAPI_ProjectPointOnSurf& aProjector2 =
(surfit == 0) ? aContext->ProjPS(theFace1) : aContext->ProjPS(theFace2);
aP3d = aSurfaceOther->Value(foundU, foundV);
aProjector2.Perform(aP3d);
@@ -4004,11 +4054,12 @@ Standard_Boolean ParameterOutOfBoundary(const Standard_Real theParameter,
const TopoDS_Face& theFace2,
const Standard_Real theOtherParameter,
const Standard_Boolean bIncreasePar,
Standard_Real& theNewParameter) {
Standard_Real& theNewParameter,
const Handle(IntTools_Context)& aContext)
{
Standard_Boolean bIsComputed = Standard_False;
theNewParameter = theParameter;
IntTools_Context aContext;
Standard_Real acurpar = theParameter;
TopAbs_State aState = TopAbs_ON;
Standard_Integer iter = 0;
@@ -4039,7 +4090,7 @@ Standard_Boolean ParameterOutOfBoundary(const Standard_Real theParameter,
if(aPrj1.IsDone()) {
aPrj1.LowerDistanceParameters(U, V);
aState = aContext.StatePointFace(theFace1, gp_Pnt2d(U, V));
aState = aContext->StatePointFace(theFace1, gp_Pnt2d(U, V));
}
if(aState != TopAbs_ON) {
@@ -4047,7 +4098,7 @@ Standard_Boolean ParameterOutOfBoundary(const Standard_Real theParameter,
if(aPrj2.IsDone()) {
aPrj2.LowerDistanceParameters(U, V);
aState = aContext.StatePointFace(theFace2, gp_Pnt2d(U, V));
aState = aContext->StatePointFace(theFace2, gp_Pnt2d(U, V));
}
}
@@ -4396,11 +4447,14 @@ Standard_Boolean ClassifyLin2d(const Handle(GeomAdaptor_HSurface)& theS,
void ApproxParameters(const Handle(GeomAdaptor_HSurface)& aHS1,
const Handle(GeomAdaptor_HSurface)& aHS2,
Standard_Integer& iDegMin,
Standard_Integer& iDegMax)
Standard_Integer& iDegMax,
Standard_Integer& iNbIter)
{
GeomAbs_SurfaceType aTS1, aTS2;
//
iNbIter=0;
iDegMin=4;
iDegMax=8;
//
@@ -4430,6 +4484,11 @@ void ApproxParameters(const Handle(GeomAdaptor_HSurface)& aHS1,
iDegMax=6;
}
}
//modified by NIZNHY-PKV Mon Jan 30 14:20:08 2012f
if (aTS1==GeomAbs_Cylinder && aTS2==GeomAbs_Cylinder) {
iNbIter=1; //ZZ
}
//modified by NIZNHY-PKV Mon Jan 30 14:20:10 2012t
}
//=======================================================================
//function : Tolerances
@@ -4544,6 +4603,7 @@ void DumpWLine(const Handle(IntPatch_WLine)& aWLine)
Standard_Integer i, aNbPnts;
Standard_Real aX, aY, aZ, aU1, aV1, aU2, aV2;
//
printf(" *WLine\n");
aNbPnts=aWLine->NbPnts();
for (i=1; i<=aNbPnts; ++i) {
const IntSurf_PntOn2S aPntOn2S=aWLine->Point(i);
@@ -4551,12 +4611,11 @@ void DumpWLine(const Handle(IntPatch_WLine)& aWLine)
aP3D.Coord(aX, aY, aZ);
aPntOn2S.Parameters(aU1, aV1, aU2, aV2);
//
//printf("point p_%d %lf %lf %lf\n", i, aX, aY, aZ);
printf("point p_%d %20.15lf %20.15lf %20.15lf %20.15lf %20.15lf %20.15lf %20.15lf\n",
i, aX, aY, aZ, aU1, aV1, aU2, aV2);
printf("point p_%d %lf %lf %lf\n", i, aX, aY, aZ);
//printf("point p_%d %20.15lf %20.15lf %20.15lf %20.15lf %20.15lf %20.15lf %20.15lf\n",
// i, aX, aY, aZ, aU1, aV1, aU2, aV2);
}
}
//modified by NIZNHY-PKV Wed Dec 14 12:22:48 2011f
//=======================================================================
//function : RefineVector
//purpose :
@@ -4588,4 +4647,63 @@ void RefineVector(gp_Vec2d& aV2D)
}
aV2D.SetCoord(aC[0], aC[1]);
}
//modified by NIZNHY-PKV Wed Dec 14 12:22:50 2011t
//modified by NIZNHY-PKV Tue Jan 31 07:38:19 2012f
//=======================================================================
//function : MaxSquareDistance
//purpose :
//=======================================================================
Standard_Real MaxSquareDistance (const Standard_Real aT,
const Handle(Geom_Curve)& aC3D,
const Handle(Geom2d_Curve)& aC2D1,
const Handle(Geom2d_Curve)& aC2D2,
const Handle(GeomAdaptor_HSurface) myHS1,
const Handle(GeomAdaptor_HSurface) myHS2,
const TopoDS_Face& aF1,
const TopoDS_Face& aF2,
const Handle(IntTools_Context)& aCtx)
{
Standard_Boolean bIsDone;
Standard_Integer i;
Standard_Real aU, aV, aD2Max, aD2;
gp_Pnt2d aP2D;
gp_Pnt aP, aPS;
//
aD2Max=0.;
//
aC3D->D0(aT, aP);
if (aC3D.IsNull()) {
return aD2Max;
}
//
for (i=0; i<2; ++i) {
const Handle(GeomAdaptor_HSurface)& aGHS=(!i) ? myHS1 : myHS2;
const TopoDS_Face &aF=(!i) ? aF1 : aF2;
const Handle(Geom2d_Curve)& aC2D=(!i) ? aC2D1 : aC2D2;
//
if (!aC2D.IsNull()) {
aC2D->D0(aT, aP2D);
aP2D.Coord(aU, aV);
aGHS->D0(aU, aV, aPS);
aD2=aP.SquareDistance(aPS);
if (aD2>aD2Max) {
aD2Max=aD2;
}
}
//
GeomAPI_ProjectPointOnSurf& aProjector=aCtx->ProjPS(aF);
//
aProjector.Perform(aP);
bIsDone=aProjector.IsDone();
if (bIsDone) {
aProjector.LowerDistanceParameters(aU, aV);
aGHS->D0(aU, aV, aPS);
aD2=aP.SquareDistance(aPS);
if (aD2>aD2Max) {
aD2Max=aD2;
}
}
}
//
return aD2Max;
}
//modified by NIZNHY-PKV Tue Jan 31 07:38:21 2012t

View File

@@ -18,8 +18,7 @@ uses
Vertex from TopoDS,
Range from IntTools,
Box from Bnd,
Context from IntTools,
PContext from IntTools
Context from IntTools
--raises
@@ -38,7 +37,19 @@ is
returns ShrunkRange from IntTools;
---Purpose:
---
SetContext(me:out;
aContext : Context from IntTools);
---Purpose:
--- Sets the intersecton context
---
Context(me)
returns Context from IntTools;
---C++: return const &
---Purpose:
--- Gets the intersecton context
---
SetShrunkRange(me:out; aR:Range from IntTools);
---Purpose:
--- Sets an shrunk range
@@ -104,8 +115,8 @@ fields
myRange : Range from IntTools;
myShrunkRange : Range from IntTools;
myBndBox : Box from Bnd;
myCtx : PContext from IntTools;
myIsDone : Boolean from Standard;
myErrorStatus : Integer from Standard;
myContext : Context from IntTools;
myIsDone : Boolean from Standard;
myErrorStatus : Integer from Standard;
end ShrunkRange;

View File

@@ -27,7 +27,7 @@
//function : IntTools_ShrunkRange
//purpose :
//=======================================================================
IntTools_ShrunkRange::IntTools_ShrunkRange ()
IntTools_ShrunkRange::IntTools_ShrunkRange ()
{
}
@@ -35,26 +35,42 @@
//function : IntTools_ShrunkRange
//purpose :
//=======================================================================
IntTools_ShrunkRange::IntTools_ShrunkRange (const TopoDS_Edge& aE,
IntTools_ShrunkRange::IntTools_ShrunkRange (const TopoDS_Edge& aE,
const TopoDS_Vertex& aV1,
const TopoDS_Vertex& aV2,
const IntTools_Range& aR,
const IntTools_Context& aCtx)
const Handle(IntTools_Context)& aCtx)
{
myEdge=aE;
myV1=aV1;
myV2=aV2;
myRange=aR;
myCtx=(IntTools_PContext)&aCtx;
myContext=aCtx;
myIsDone=Standard_False;
myErrorStatus=1;
Perform();
}
//=======================================================================
//function : SetContext
//purpose :
//=======================================================================
void IntTools_ShrunkRange::SetContext(const Handle(IntTools_Context)& aContext)
{
myContext=aContext;
}
//=======================================================================
//function : Context
//purpose :
//=======================================================================
const Handle(IntTools_Context)& IntTools_ShrunkRange::Context()const
{
return myContext;
}
//=======================================================================
//function : Edge
//purpose :
//=======================================================================
const TopoDS_Edge& IntTools_ShrunkRange::Edge() const
const TopoDS_Edge& IntTools_ShrunkRange::Edge() const
{
return myEdge;
}
@@ -62,7 +78,7 @@
//function : ShrunkRange
//purpose :
//=======================================================================
const IntTools_Range& IntTools_ShrunkRange::ShrunkRange() const
const IntTools_Range& IntTools_ShrunkRange::ShrunkRange() const
{
return myShrunkRange;
}
@@ -70,7 +86,7 @@
//function : BndBox
//purpose :
//=======================================================================
const Bnd_Box& IntTools_ShrunkRange::BndBox() const
const Bnd_Box& IntTools_ShrunkRange::BndBox() const
{
return myBndBox;
}
@@ -78,7 +94,7 @@
//function : IsDone
//purpose :
//=======================================================================
Standard_Boolean IntTools_ShrunkRange::IsDone() const
Standard_Boolean IntTools_ShrunkRange::IsDone() const
{
return myIsDone;
}
@@ -86,7 +102,7 @@
//function : ErrorStatus
//purpose :
//=======================================================================
Standard_Integer IntTools_ShrunkRange::ErrorStatus() const
Standard_Integer IntTools_ShrunkRange::ErrorStatus() const
{
return myErrorStatus;
}
@@ -94,7 +110,7 @@
//function : Perform
//purpose :
//=======================================================================
void IntTools_ShrunkRange::Perform()
void IntTools_ShrunkRange::Perform()
{
Standard_Real aCF, aCL, aTolE, aTolV1, aTolV2, t1, t11, t1C, t2, t12, t2C;
Standard_Real aCoeff, dt1, dt2, aR;
@@ -103,13 +119,14 @@
GeomAbs_CurveType aCurveType;
Handle(Geom_Curve) aC;
//
if (myContext.IsNull()) {
myContext=new IntTools_Context;
}
//
aTolE =BRep_Tool::Tolerance(myEdge);
aTolV1=BRep_Tool::Tolerance(myV1);
aTolV2=BRep_Tool::Tolerance(myV2);
//xf
//dt1=aCoeff*(aTolV1+aTolE);
//dt2=aCoeff*(aTolV2+aTolE);
//xt
//
myRange.Range (t1, t2);
//
BRepAdaptor_Curve aBAC(myEdge);
@@ -272,15 +289,10 @@
BRepBuilderAPI_MakeVertex aMV1(aP1L);
const TopoDS_Vertex& aV1L=aMV1.Vertex();
//
pri=myCtx->ComputeVE (aV1L, myEdge, t1C);
pri=myContext->ComputeVE (aV1L, myEdge, t1C);
//
if (pri==-3) {
//modified by NIZNHY-PKV Tue Apr 6 14:06:29 2010
t1C = t1;
//myErrorStatus=4;
//return;
//modified by NIZNHY-PKV Tue Apr 6 14:06:31 2010
}
}
}
@@ -369,14 +381,10 @@
BRepBuilderAPI_MakeVertex aMV2(aP2L);
const TopoDS_Vertex& aV2L=aMV2.Vertex();
//
pri=myCtx->ComputeVE (aV2L, myEdge, t2C);
pri=myContext->ComputeVE (aV2L, myEdge, t2C);
//
if (pri==-3) {
//modified by NIZNHY-PKV Tue Apr 6 14:07:34 2010f
t2C = t2;
//myErrorStatus=5;
//return;
//modified by NIZNHY-PKV Tue Apr 6 14:07:39 2010t
}
}
}